Beispiel #1
0
        private tCoupon ValidateCoupon(CouponConsumeModel couponData)
        {
            tCoupon coupon = _coupoRepository.FindByCustomNo(couponData.CouponNo);

            if (coupon == null)
            {
                ModelState.AddModelError("Coupon", "Coupon Not Found!");
                return(coupon);
            }
            int UserID = (int)MembershipHelper.GetCurrenUser().ProviderUserKey;

            if (coupon.IDPartner != UserID)
            {
                ModelState.AddModelError("Coupon", "User is Wrong For this Coupon!");
                return(coupon);
            }
            if (coupon.Code != couponData.CouponCode)
            {
                ModelState.AddModelError("Coupon", "Coupon Code Not Valid!");
                return(coupon);
            }
            return(coupon);
        }