@RequestMapping(value = "/list/delete", method = RequestMethod.GET) public String delete(@RequestParam(value = "itemId", required = true) Integer id, Model model) { ToDoItem userDeleted = toDoItemService.get(id); toDoItemService.delete(userDeleted); return "redirect:/list"; }
@RequestMapping( value = {"/list/edit"}, method = RequestMethod.GET) public String editItemForm( @RequestParam(value = "itemId", required = true) Integer id, Model model) { ToDoItem toDoItem = toDoItemService.get(id); model.addAttribute("itemEdit", toDoItem); model.addAttribute("categories", categoryService.getAll()); return "/edit-todo-item"; }