Esempio n. 1
0
 @RequestMapping(value = "/user/coupon-list", method = RequestMethod.GET)
 public ModelAndView updateCoupon(
     final HttpServletRequest request, final HttpServletResponse response) throws KUException {
   Model model = new ExtendedModelMap();
   model.addAttribute("activeMenu", "offer-link");
   model.addAttribute("offerList", offerManager.getAllOffers());
   return new ModelAndView("/ku/coupon-list", model.asMap());
 }
Esempio n. 2
0
 @RequestMapping(value = "/user/add-coupon", method = RequestMethod.POST)
 @ModelAttribute
 public ModelAndView addCoupon(
     @ModelAttribute("offer") Offer offer,
     BindingResult errors,
     final HttpServletRequest request,
     final HttpServletResponse response) {
   Model model = new ExtendedModelMap();
   try {
     log.info("adding coupon :: " + offer.getOfferTitle());
     offer = offerManager.saveOffer(offer);
     model.addAttribute("offer", offer);
     log.info("coupon added");
     model.addAttribute("activeMenu", "offer-link");
     model.addAttribute("offerList", offerManager.getAllOffers());
     saveMessage(request, "coupon added successfully");
   } catch (KUException e) {
     e.printStackTrace();
     saveError(request, "problem in adding coupon");
     model.addAttribute("offer", offer);
   }
   model.addAttribute("activeMenu", "offer-link");
   return new ModelAndView("/ku/coupon-list", model.asMap());
 }