private double?GetCustomerMargin() { try { if (Session["PromoCode"] != null && Session["PromoCode"].ToString() != "") { ViewModel.PromotionCodes.PromotionCodes promotionCodes = new ViewModel.PromotionCodes.PromotionCodes(); return(promotionCodes.GetPromoCodeByCoode(Session["PromoCode"].ToString()).Amount); } return(0); } catch { return(0); } }
public ActionResult Cart(string PromoCode, string DefaultPercentage) { if (PromoCode != null && PromoCode != "") { Session["PromoCode"] = PromoCode; ViewModel.PromotionCodes.PromotionCodes promotionCodes = new ViewModel.PromotionCodes.PromotionCodes(); var code = promotionCodes.GetPromoCodeByCoode(Session["PromoCode"].ToString()); if (code != null) { Session["Margin"] = code.Amount; TempData["Margin"] = code.Amount; } } else { Session["Margin"] = DefaultPercentage; TempData["Margin"] = DefaultPercentage; } return(RedirectToAction("cart")); }