Exemple #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");
 }
Exemple #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");
 }
Exemple #3
0
 // just because get is easier here. Be my guest if you want to change.
 @RequestMapping(method = RequestMethod.GET, value = "/remove/{id}")
 public String remove(@PathVariable("id") Integer id) {
   Ferias ferias = feriasRepository.findOne(id);
   feriasRepository.delete(ferias);
   return "redirect:/ferias/list";
 }
Exemple #4
0
 @RequestMapping(value = "/list-visu", method = RequestMethod.GET)
 public ModelAndView listVisualizacao() {
   ModelAndView modelAndView = new ModelAndView("ferias/list-visu");
   modelAndView.addObject("paginatedList", feriasRepository.findAll());
   return modelAndView;
 }
Exemple #5
0
 @RequestMapping(method = RequestMethod.GET, value = "/load/{id}")
 public ModelAndView load(@PathVariable("id") Integer id) {
   ModelAndView modelAndView = new ModelAndView("ferias/form-update");
   modelAndView.addObject("ferias", feriasRepository.findOne(id));
   return modelAndView;
 }