@RequestMapping(value = "delete.htm", method = RequestMethod.GET) public String delete(Long id, ModelMap m) { OfferTypeEntity type; try { type = offerTypeManager.findById(id); type.getId(); } catch (Exception e) { return "redirect:show.htm"; } offerTypeManager.delete(type); return "redirect:show.htm"; }
@RequestMapping(value = "save.htm", method = RequestMethod.POST) public String save(OfferTypeEntity formModel, BindingResult result, ModelMap m) { OfferTypeEntity type; try { type = offerTypeManager.findById(formModel.getId()); type.getId(); } catch (Exception e) { return "redirect:show.htm"; } type.setName(formModel.getName()); type.setDescription(formModel.getDescription()); offerTypeManager.update(type); return "redirect:show.htm"; }
@RequestMapping(value = "edit.htm", method = RequestMethod.GET) public String edit(Long id, ModelMap m) { OfferTypeEntity type; try { type = offerTypeManager.findById(id); type.getId(); } catch (Exception e) { return "redirect:show.htm"; } m.addAttribute("formModel", type); return PATH_VIEW + "/edit"; }
@RequestMapping(value = "submit.htm", method = RequestMethod.POST) public String submit(OfferTypeEntity formModel, BindingResult result, ModelMap m) { offerTypeManager.add(formModel); return "redirect:show.htm"; }
@RequestMapping(value = "show.htm", method = RequestMethod.GET) public String show(ModelMap m) { Collection<OfferTypeEntity> allTypes = offerTypeManager.findAll(); m.addAttribute("allTypes", allTypes); return PATH_VIEW + "/show"; }