1
Answer

Multiple Where Conditions In Linq

I want to retrieve the agencyName added between the date ranges arrivalFDate & arrivalTDate . How do I add a linq query having multiple where conditions. ArrivalDate is field of InternationalArrivals.
 
Like the same way as : SELECT * FROM InternationalArrival where AgentName=@agentName, ArrivalDate IN BETWEEN (@arrivalFDate , @arrivalTDate )
 
string agentName = result[0];
DateTime arrivalFDate = DateTime.ParseExact(result[1], "dd/MM/yyyy", CultureInfo.InvariantCulture);
DateTime arrivalTDate = DateTime.ParseExact(result[2], "dd/MM/yyyy", CultureInfo.InvariantCulture);
List<InternationalArrival> intarrivals = null;
using (var _context = new SQLHELPSEntities())
{
intarrivals = _context.InternationalArrivals.Where(t => t.AgentName.Contains(agentName)).OrderBy(a => a.AgentName).ToList(); ++++++++++WHERE CONDITION OF DATERANGE FIELD CONTAINS where ArrivalDate In BETWEEN arrivalFDate & arrivalTDate
Answers (1)