Пример #1
0
 @RequestMapping(value = "/save", method = RequestMethod.POST)
 public ModelAndView save(@Valid Ferias ferias, BindingResult bindingResult) {
   if (bindingResult.hasErrors()) {
     return form(ferias);
   }
   feriasRepository.save(ferias);
   return new ModelAndView("redirect:/ferias/novo-ferias");
 }
Пример #2
0
 @RequestMapping(method = RequestMethod.POST, value = "/form-update/{id}")
 public ModelAndView update(
     @PathVariable("id") Integer id, @Valid Ferias ferias, BindingResult bindingResult) {
   ferias.setId(id);
   if (bindingResult.hasErrors()) {
     return new ModelAndView("ferias/form-update");
   }
   feriasRepository.save(ferias);
   return new ModelAndView("redirect:/ferias/list");
 }