/** * POST * * <p>Create accounting system * * @param accountingSystem * @return String ( years list ) */ @RequestMapping(value = "/", method = RequestMethod.POST) public String create( @Valid @ModelAttribute AccountingSystem accountingSystem, BindingResult result) { if (result.hasErrors()) { return "createAccountingSystem"; } try { AccountingSystem newAccountingSystem1 = new AccountingSystem(); newAccountingSystem1.setName(accountingSystem.getName()); accountingSystemService.create(newAccountingSystem1); } catch (Exception e) { Error error; } return REDIRECT_ACS_LIST; }
/** * POST * * <p>Update exist accountingSystem * * @param accountingSystem * @param id * @return String ( years list ) */ @RequestMapping(value = "/update/{ID}", method = RequestMethod.POST) public String update( @PathVariable("ID") Long id, @Valid @ModelAttribute AccountingSystem accountingSystem, BindingResult result, ModelMap model) { AccountingSystem updatedAccountingSystem = accountingSystemService.find(id); if (result.hasErrors()) { model.addAttribute("accountingSystem", accountingSystem); return "updateAccountingSystem"; } updatedAccountingSystem.setName(accountingSystem.getName()); accountingSystemService.update(updatedAccountingSystem); return REDIRECT_ACS_LIST; }