@RequestMapping("save") public String save(Visita vis) { if (vis.getId() == null) { visitaDAO.saveDAO(vis); } else { visitaDAO.updateDAO(vis); } return "redirect:/com/atencion"; }
@RequestMapping("update/{id}") public String update(@PathVariable("id") Long id, Model model) { Visita vis = visitaDAO.find(new Visita(id)); model.addAttribute("visita", vis); model.addAttribute("mascotas", mascotaDAO.all()); model.addAttribute("veterinarios", veterinarioDAO.all()); return "comercial/atencion/visitaForm"; }
@RequestMapping("delete/{id}") public String delete(@PathVariable("id") Long id) { visitaDAO.deleteDAO(new Visita(id)); return "redirect:/com/atencion"; }
@RequestMapping(method = RequestMethod.GET) public String index(Model model) { model.addAttribute("visitas", visitaDAO.all()); return "comercial/atencion/visita"; }