I'm trying to write a select query which returns records where the input date range falls between two date fields in a LINQ query.
My inputs are:
- date1 - start date
- date2 - end date
My database fields are
- AppointmentStart
- AppointmentEnd
Additionally, I'd also like to ensure that an input of 14:00 - 15:00 doesn't return a value for 15:00-16:00.
return (from t1 in db.Appointments where (t1.AppointmentStart <= date2 && (t1.AppointmentEnd) >= date1)
If anybody can assist me with this, I'd appreciate it.
See Question&Answers more detail:os