Beispiel #1
0
 @RequestMapping(value = "")
 public String list(
     @RequestParam(value = "sortType", defaultValue = "auto") String sortType,
     @RequestParam(value = "page", defaultValue = "1") int pageNumber,
     Model model,
     ServletRequest request) {
   model.addAttribute("action", "create");
   model.addAttribute("coachs", coachService.getAllCoachs());
   return "coach/coachList";
 }
Beispiel #2
0
 @RequestMapping(value = "create", method = RequestMethod.POST)
 public String create(
     @Valid Coach newCoach,
     @RequestParam("file") CommonsMultipartFile mediaFile,
     RedirectAttributes redirectAttributes) {
   try {
     createFile(mediaFile, newCoach);
   } catch (Exception e) {
     e.printStackTrace();
   }
   coachService.saveCoach(newCoach);
   redirectAttributes.addFlashAttribute("message", "创建教练成功");
   return "redirect:/coach";
 }
Beispiel #3
0
 @RequestMapping(value = "delete/{id}")
 public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) {
   coachService.deleteCoach(id);
   redirectAttributes.addFlashAttribute("message", "删除教练成功");
   return "redirect:/coach/";
 }
Beispiel #4
0
 @RequestMapping(value = "update", method = RequestMethod.POST)
 public String update(@Valid Coach coach, RedirectAttributes redirectAttributes) {
   coachService.updateCoach(coach);
   redirectAttributes.addFlashAttribute("message", "更新教练成功");
   return "redirect:/coach/";
 }
Beispiel #5
0
 @RequestMapping(value = "update/{id}", method = RequestMethod.GET)
 public String updateForm(@PathVariable("id") Long id, Model model) {
   model.addAttribute("coach", coachService.getCoach(id));
   model.addAttribute("action", "update");
   return "coach/coachForm";
 }