Beispiel #1
0
        public ActionResult Index(string CouponCode)
        {
            CouponCode = CouponCode.Trim().Replace(" ", "");
            CouponModel model = new CouponModel();
            var         cart  = (CartModel)System.Web.HttpContext.Current.Session["cart"];

            var coupon = model.GetList().FirstOrDefault(m => m.CouponCode == CouponCode);


            if (coupon != null)
            {
                cart.CouponApplied = true;
                cart.CouponId      = coupon.CouponId;
                cart.CouponCode    = coupon.CouponCode;


                cart.Price = cart.Price - cart.Price * 20 / 100;
                cart.Total = cart.Price * cart.Quantity;
                System.Web.HttpContext.Current.Session["cart"] = cart;

                ViewBag.Message = "Coupon is applied Successfully";
            }
            else
            {
                ViewBag.Message = "Coupon not found or Expired!";
            }

            return(View(cart));
        }
        public ActionResult Edit(int?id, CouponModel model)
        {
            if (id != null)
            {
                model = model.GetList().FirstOrDefault(m => m.CouponId == id);
            }

            return(View(model));
        }
        public ActionResult Index(CouponModel model)
        {
            var list = model.GetList();

            return(View(list));
        }