@RequestMapping(value = "/new", method = RequestMethod.POST) public String processPlanNewBreakfastTask( @Valid @ModelAttribute("command") PlanNewBreakfastCommand command, BindingResult result, SessionStatus status) { if (result.hasErrors()) { return "usecases/planNewBreakfast"; } Breakfast plannedBreakfast = breakfastService.planNewBreakfast(command); status.setComplete(); return "redirect:/breakfast/" + plannedBreakfast.getId(); }
@RequestMapping(value = "/{id}", method = RequestMethod.GET) public String show(@PathVariable("id") int id, Map<String, Object> model) { model.put("breakfast", breakfastService.get(id)); return "usecases/ShowBreakfastDetails"; }
@RequestMapping(value = "/", method = RequestMethod.GET) public String list(Map<String, Object> model) { model.put("breakfasts", breakfastService.getAll()); return "usecases/showAllPlannedBreakfast"; }