Exemplo n.º 1
0
  @RequestMapping("/delete/{id}")
  public String edit(@PathVariable Integer id) {

    customerService.deleteById(id);

    return "redirect:/customer/list";
  }
Exemplo n.º 2
0
  @RequestMapping(method = RequestMethod.POST)
  public String saveOrUpdateProduct(Customer customer) {

    Customer savedCustomer = customerService.saveOrUpdate(customer);

    return "redirect:/customer/show/" + savedCustomer.getId();
  }
Exemplo n.º 3
0
  @RequestMapping("/show/{id}")
  public String getProduct(@PathVariable Integer id, Model model) {

    model.addAttribute("customer", customerService.getById(id));

    return "customer/show";
  }
Exemplo n.º 4
0
  @RequestMapping("/edit/{id}")
  public String edit(@PathVariable Integer id, Model model) {

    model.addAttribute("customer", customerService.getById(id));

    return "customer/customerform";
  }
Exemplo n.º 5
0
  @RequestMapping({"/list", "/"})
  public String listCustomers(Model model) {

    model.addAttribute("customers", customerService.listAll());

    return "customer/list";
  }