@RequestMapping(value = "save", method = RequestMethod.POST) public String save(@ModelAttribute Persona persona) { if (persona.getId() == null) { service.save(persona); } else { service.update(persona); } return "redirect:/adm/socio"; }
@RequestMapping("delete/{id}") public String delete(@PathVariable long id) { service.delete(new Persona(id)); return "redirect:/adm/socio"; }
@RequestMapping(method = RequestMethod.GET) public String index(Model model) { model.addAttribute("socios", service.list()); return "adm/socio/socio"; }
@RequestMapping("update/{id}") public String update(@PathVariable long id, Model model) { Persona persona = service.get(new Persona(id)); if (persona == null) { return "redirect:/adm/socio"; } model.addAttribute("socio", persona); return "adm/socio/socioForm"; }