daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Jul 23rd, 2018 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //CRUD SPRING
  2.  
  3. //EDIT
  4. @GetMapping("/edit/{id}")
  5.     public ModelAndView edit(@PathVariable("id") Long id) {
  6.         return add(service.findOne(id));
  7.  
  8.     }
  9. //DELETE
  10. @GetMapping("/delete/{id}")
  11.     public ModelAndView delete(@PathVariable("id") Long id) {
  12.        
  13.         service.delete(id);
  14.        
  15.         return findAll();
  16.     }
  17. //SAVE
  18. @PostMapping("/save")
  19.     public ModelAndView save(@Valid Post post, BindingResult result) {
  20.        
  21.         if(result.hasErrors()) {
  22.             return add(post);
  23.         }
  24.        
  25.         service.save(post);
  26.        
  27.         return findAll();
  28.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top