Esempio n. 1
0
 public ActionResult GenerateCode(Models.PromotionCodes p)
 {
     if (p.Code == null || p.Code == "")
     {
         p.Code = (string)TempData["PromoCode"];
     }
     ViewModel.PromotionCodes.PromotionCodes promotionCodes = new ViewModel.PromotionCodes.PromotionCodes();
     promotionCodes.SavePromoCode(p);
     return(RedirectToAction("PromoCode"));
 }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
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"));
 }
Esempio n. 4
0
        public ActionResult GenerateCode(int?id)
        {
            Models.PromotionCodes promotionCodes = new PromotionCodes();
            if (id == null)
            {
                Random generator = new Random();
                string promoCode = generator.Next(0, 999999).ToString("D6");
                TempData["PromoCode"]     = promoCode;
                promotionCodes.Code       = promoCode;
                promotionCodes.ExpiryDate = DateTime.Now;
            }
            else
            {
                ViewModel.PromotionCodes.PromotionCodes promo = new ViewModel.PromotionCodes.PromotionCodes();
                promotionCodes            = promo.GetPromoCodeById(id);
                promotionCodes.ExpiryDate = promotionCodes.ExpiryDate.Date;
            }


            return(View(promotionCodes));
        }
Esempio n. 5
0
        //public ActionResult EditPromoCode(int id, string code,DateTime exp)
        //{

        //}

        public ActionResult DeletePromoCode(int id)
        {
            ViewModel.PromotionCodes.PromotionCodes promotionCodes = new ViewModel.PromotionCodes.PromotionCodes();
            promotionCodes.DeletePromoCode(id);
            return(RedirectToAction("PromoCode"));
        }
Esempio n. 6
0
 public ActionResult PromoCode()
 {
     ViewModel.PromotionCodes.PromotionCodes promotionCodes = new ViewModel.PromotionCodes.PromotionCodes();
     return(View(promotionCodes.GetList()));
 }