public async Task <IEnumerable <Car> > GetCarsOnDiscount(int enterpriseId) { var temp = await repo2.GetCarsOnDiscount(enterpriseId); List <Car> retVal = new List <Car>(); foreach (var car in temp.Cars) { List <string> datesBetween = new List <string>(); foreach (var discountPeriod in car.Discounts) { for (var date = discountPeriod.DiscountFrom; date <= discountPeriod.DiscountTo; date = date.AddDays(1)) { datesBetween.Add(date.ToShortDateString()); } } foreach (var a in datesBetween) { if (DateTime.Now.ToShortDateString() == a) { retVal.Add(car); break; } } } return(retVal); }