コード例 #1
0
  @RequestMapping(value = "/{id}/control-letters/create", method = RequestMethod.GET)
  public String showControlLetterCreateForm(@PathVariable("id") int id, Model model) {
    ControlLetter controlLetter = new ControlLetter();
    // TODO: Validate income id that coming from form
    controlLetter.setIncomeId(id);

    List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CASIER.getId());

    model.addAttribute("controlLetter", controlLetter);
    model.addAttribute("employees", employees);

    return "controlLetter/edit";
  }
コード例 #2
0
  @RequestMapping(value = "/{invoiceId}/control-letters/{id}")
  public String showControlLetter(
      @PathVariable("invoiceId") int invoiceId, @PathVariable("id") int id, Model model) {

    ControlLetter controlLetter = controlLetterService.find(id);
    if (controlLetter == null) throw new ResourceNotFoundException();
    controlLetter.setIncomeId(invoiceId);

    List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CASIER.getId());

    model.addAttribute("employees", employees);
    model.addAttribute("controlLetter", controlLetter);
    return "controlLetter/edit";
  }