Exemplo n.º 1
0
        public ActionResult ApplyCouponCode(string cvalue)
        {
            var status = false;

            try
            {
                if (cvalue.Trim() != "")
                {
                    cvalue = cvalue.ToLower();
                    var coupondetail = _mainobj.GetByCouponCode(cvalue);
                    if (coupondetail != null)
                    {
                        var cmsg    = coupondetail.cmsgforuser;
                        var camount = coupondetail.camount;
                        status = true;
                        return(new JsonResult {
                            Data = new { status = status, message = cmsg, newamount = camount, couponmessage = "Coupon code applied." }
                        });
                    }
                }
            }
            catch { }
            return(new JsonResult {
                Data = new { status = status, couponmessage = "Coupon code is expired." }
            });
        }