@RequestMapping("{id}/toUpdate") public String toUpdate(@PathVariable Long id,Model model){ Blog blog=blogService.getBlog(id); blog.initTags(id); model.addAttribute("blog",blog); model.addAttribute("types",typeService.listType()); model.addAttribute("tags",tagService.listType()); return"admin/blogs-input"; }
@GetMapping("{id}/delete") public String delete(@PathVariable Long id){ tagService.deleteType(id); return"redirect:/admin/tags"; } @GetMapping("input") public String input(Model model){ model.addAttribute("tag",newTag()); return"admin/tags-input"; }
@PostMapping("add") public String add(Tag tag){ tagService.addTag(tag); return"redirect:/admin/tags"; }
@GetMapping("{id}/toUpdate") public String toUpdate(@PathVariable Long id, Model model, RedirectAttributes attributes){ Tag tag=tagService.getTag(id); model.addAttribute("tag",tag); return"admin/tags-input";
}
@PostMapping("update/{id}") public String update(Tag type,@PathVariable Long id){ tagService.update(id,type); return"redirect:/admin/tags"; }
//@{/admin/types/{id}/delete(id=${type.id})} @GetMapping("{id}/delete") public String delete(@PathVariable Long id){ typeService.deleteType(id); return"redirect:/admin/types"; }
@GetMapping("input") public String input(Model model){ model.addAttribute("type",newType()); return"admin/types-input"; }
@PostMapping("add") public String add(Type type){ typeService.addType(type); return"redirect:/admin/types"; }
@GetMapping("{id}/toUpdate") public String toUpdate(@PathVariable Long id, Model model, RedirectAttributes attributes){ Type type=typeService.getType(id); model.addAttribute("type",type); return"admin/types-input";
}
@PostMapping("update/{id}") public String update(Type type,@PathVariable Long id){ typeService.update(id,type); return"redirect:/admin/types"; }