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); }
public Promotion GetPromotionById(string id) { var retVal = Promotions.Include(x => x.Coupons).FirstOrDefault(x => x.Id == id); return(retVal); }