public Promotion[] GetActivePromotions()
        {
            var now    = DateTime.UtcNow;
            var retVal = Promotions.Include(x => x.Coupons).Where(x => x.IsActive && (x.StartDate == null || now >= x.StartDate) && (x.EndDate == null || x.EndDate >= now))
                         .OrderByDescending(x => x.Priority).ToArray();

            return(retVal);
        }
예제 #2
0
        public Promotion GetPromotionById(string id)
        {
            var retVal = Promotions.Include(x => x.Coupons).FirstOrDefault(x => x.Id == id);

            return(retVal);
        }