示例#1
0
  @RequestMapping("/delete/{id}")
  public String edit(@PathVariable Integer id) {

    customerService.deleteById(id);

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

    Customer savedCustomer = customerService.saveOrUpdate(customer);

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

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

    return "customer/show";
  }
示例#4
0
  @RequestMapping("/edit/{id}")
  public String edit(@PathVariable Integer id, Model model) {

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

    return "customer/customerform";
  }
示例#5
0
  @RequestMapping({"/list", "/"})
  public String listCustomers(Model model) {

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

    return "customer/list";
  }