コード例 #1
0
 @RequestMapping(value = "/admin/taxRates/{taxRateId}/edit", method = RequestMethod.POST)
 public String taxRateEditSave(
     @PathVariable long taxRateId,
     @RequestParam(value = "page", defaultValue = FIRST_PAGE) int page,
     @Valid TaxRate thisTaxRate,
     BindingResult result,
     Model model) {
   logger.info("TaxRate: " + thisTaxRate.toString());
   if (result.hasErrors()) {
     int menuCategory = AdminMenuCategory.LOCATION_TAXES.ordinal();
     model.addAttribute("menuCategory", menuCategory);
     model.addAttribute("thisTaxRate", thisTaxRate);
     Pageable pageRequest = new PageRequest(page, PAGE_SIZE, Sort.Direction.ASC, "priority");
     Page<TaxRate> taxRates = taxRateService.findAll(pageRequest);
     model.addAttribute("taxRates", taxRates);
     return "admin/taxes/taxRatesEditForm";
   } else {
     TaxRate loadedTaxRate = taxRateService.findById(taxRateId);
     loadedTaxRate.setLastModified(new Date());
     loadedTaxRate.setPriority(thisTaxRate.getPriority());
     loadedTaxRate.setTaxRate(thisTaxRate.getTaxRate());
     loadedTaxRate.setTaxClass(thisTaxRate.getTaxClass());
     loadedTaxRate.setTaxZone(thisTaxRate.getTaxZone());
     taxRateService.update(loadedTaxRate);
     return "redirect:/admin/taxRates/" + taxRateId + "?page=" + page;
   }
 }
コード例 #2
0
 @RequestMapping(value = "/admin/taxRates/{taxRateId}/delete", method = RequestMethod.POST)
 public String taxRateDeleteSave(
     @PathVariable long taxRateId,
     @RequestParam(value = "page", defaultValue = FIRST_PAGE) int page,
     Model model) {
   TaxRate thisTaxRate = taxRateService.findById(taxRateId);
   taxRateService.delete(thisTaxRate);
   return "redirect:/admin/taxRates?page=" + page;
 }
コード例 #3
0
 @RequestMapping(value = "/admin/taxRates/{taxRateId}/delete", method = RequestMethod.GET)
 public String taxRateDeleteForm(
     @PathVariable long taxRateId,
     @RequestParam(value = "page", defaultValue = FIRST_PAGE) int page,
     Model model) {
   int menuCategory = AdminMenuCategory.LOCATION_TAXES.ordinal();
   model.addAttribute("menuCategory", menuCategory);
   TaxRate thisTaxRate = taxRateService.findById(taxRateId);
   model.addAttribute("thisTaxRate", thisTaxRate);
   Pageable pageRequest = new PageRequest(page, PAGE_SIZE, Sort.Direction.ASC, "priority");
   Page<TaxRate> taxRates = taxRateService.findAll(pageRequest);
   model.addAttribute("taxRates", taxRates);
   return "admin/taxes/taxRatesDeleteForm";
 }