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, "كوبون غير صالح", ""))); } }
public IHttpActionResult checkCoupon(CheckCounpon coupon) { if (string.IsNullOrEmpty(coupon.Name)) { return(NotFound()); } var result = couponService.CheckCoupon(coupon.Name); if (result != null) { return(Ok(result)); } return(NotFound()); }