In the first the business is car rental system .
I want to get all car where has no orders in interval selected by user
public List<Car> SearchCar(DateTime pickdate, DateTime dropdate)
{
var db = new CarRentalDBEntities();
var temp = new List<Car>();
temp = db.Cars.Where(item =>
!item.Orders.Any
(e => e.PickUpDateTime >= pickdate && dropdate <= e.DropDataTime)
).ToList();
return temp;
}
this is the last code I write
- the error is : cars still comes if order intersect with interval user choosed