@RequestMapping(value = "/addUOM", method = RequestMethod.GET) public ModelAndView index(HttpServletRequest request, HttpServletResponse response) { System.out.println("addUOM Called"); Map<String, Object> model = new HashMap<String, Object>(); model.put("uomList", uomSettingsManager.getUOM()); return new ModelAndView("addUOM", model); }
@RequestMapping(value = "/saveUOM", method = RequestMethod.POST) public @ResponseBody Object addUOM( HttpServletRequest request, @ModelAttribute("uom") UnitOfMeasurement uom) { System.out.println("SaveUOM Called"); UnitOfMeasurement savedUOMs = uomSettingsManager.saveUOM(uom); Map<String, Object> model = new HashMap<String, Object>(); model.put("savedUOMs", savedUOMs); return model; }
@RequestMapping(value = "/deleteUOM", method = RequestMethod.POST) public @ResponseBody Object deleteUOM(HttpServletRequest request) { System.out.println("deleteUOM Called"); Map<String, Object> model = new HashMap<String, Object>(); int id = Integer.parseInt(request.getParameter("id")); try { uomSettingsManager.removeUOM(id); model.put("success", true); } catch (Exception e) { model.put("success", false); } return model; }