Пример #1
0
        public ActionResult ApplyCoupon(String couponCode)
        {
            //var checkout = Session["checkout"] as CheckOutDTO;
            if (_couponService.CheckCoupon(couponCode))
            {
                CouponDTO couppDto = _couponService.GetCoupon(couponCode, CurrentLanguage, CurrentCurrency);
                var       Message  = "";
                if (couppDto.IsPercentage)
                {
                    Message  = couppDto.Value.ToString();
                    Message += " %" + "حسم";
                }
                else
                {
                    Message = "- " + couppDto.ValueDisplay;
                }

                // checkout.Coupon = couppDto;
                //Session["checkout"] = checkout;
                _checkOutService.SetCoupon(User.Identity.GetUserId(), couponCode);
                return(Json(new OperationDetails(true, Message, Utils.GetValueCurrencyDisplay(Utils.getCurrencyName(CurrentCurrency, CurrentLanguage), checkout.TotalCost))));
            }
            else
            {
                //checkout.Coupon = new CouponDTO();

                return(Json(new OperationDetails(false, "كوبون غير صالح", "")));
            }
        }