Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CRUD SPRING
- //EDIT
- @GetMapping("/edit/{id}")
- public ModelAndView edit(@PathVariable("id") Long id) {
- return add(service.findOne(id));
- }
- //DELETE
- @GetMapping("/delete/{id}")
- public ModelAndView delete(@PathVariable("id") Long id) {
- service.delete(id);
- return findAll();
- }
- //SAVE
- @PostMapping("/save")
- public ModelAndView save(@Valid Post post, BindingResult result) {
- if(result.hasErrors()) {
- return add(post);
- }
- service.save(post);
- return findAll();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement