예제 #1
0
  @RequestMapping("save")
  public String save(Visita vis) {

    if (vis.getId() == null) {
      visitaDAO.saveDAO(vis);
    } else {
      visitaDAO.updateDAO(vis);
    }
    return "redirect:/com/atencion";
  }
예제 #2
0
  @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";
  }
예제 #3
0
  @RequestMapping("delete/{id}")
  public String delete(@PathVariable("id") Long id) {

    visitaDAO.deleteDAO(new Visita(id));
    return "redirect:/com/atencion";
  }
예제 #4
0
  @RequestMapping(method = RequestMethod.GET)
  public String index(Model model) {

    model.addAttribute("visitas", visitaDAO.all());
    return "comercial/atencion/visita";
  }