@RequestMapping("/delete/{id}") public String edit(@PathVariable Integer id) { customerService.deleteById(id); return "redirect:/customer/list"; }
@RequestMapping(method = RequestMethod.POST) public String saveOrUpdateProduct(Customer customer) { Customer savedCustomer = customerService.saveOrUpdate(customer); return "redirect:/customer/show/" + savedCustomer.getId(); }
@RequestMapping("/show/{id}") public String getProduct(@PathVariable Integer id, Model model) { model.addAttribute("customer", customerService.getById(id)); return "customer/show"; }
@RequestMapping("/edit/{id}") public String edit(@PathVariable Integer id, Model model) { model.addAttribute("customer", customerService.getById(id)); return "customer/customerform"; }
@RequestMapping({"/list", "/"}) public String listCustomers(Model model) { model.addAttribute("customers", customerService.listAll()); return "customer/list"; }