Esempio n. 1
0
        public ActionResult EditPromotionCoupons(int id)
        {
            var promotion = _contentLoader.Get <PromotionData>(new ContentReference(id));
            var coupons   = _couponService.GetByPromotionId(id);

            return(View(new PromotionCouponsViewModel
            {
                Coupons = coupons ?? new List <UniqueCoupon>(),
                Promotion = promotion,
                PromotionId = promotion.ContentLink.ID,
                MaxRedemptions = 1
            }));
        }
Esempio n. 2
0
        private void CheckMultiple(PromotionData promotion, PromotionInformation promotionInformation)
        {
            var uniqueCodes = _uniqueCouponService.GetByPromotionId(promotion.ContentLink.ID);

            if (uniqueCodes == null || !uniqueCodes.Any())
            {
                return;
            }

            var uniqueCode = uniqueCodes.FirstOrDefault(x =>
                                                        x.Code.Equals(promotionInformation.CouponCode, StringComparison.OrdinalIgnoreCase));

            if (uniqueCode == null)
            {
                return;
            }

            uniqueCode.UsedRedemptions++;
            _uniqueCouponService.SaveCoupons(new List <UniqueCoupon> {
                uniqueCode
            });
        }