Can you please explain this what I am doing wrong here
I am using a search criteria in linq and having this problem while filtering the results that if I used the one generic variable then it doesn't search as expected.
I used separate variable and it worked
Works fine:
string city = Request.QueryString["city"];
properties = (Request.QueryString["city"] != null) ? properties.Where(x => x.City == city) : properties;
string pType = Request.QueryString["propertytype"];
properties = (Request.QueryString["propertytype"] != null) ? properties.Where(x => x.PropertyType == pType) : properties;
Doesn't work when I use the one generic variable:
string searchCriteria = Request.QueryString["city"];
properties = (Request.QueryString["city"] != null) ? properties.Where(x => x.City == searchCriteria) : properties;
searchCriteria= Request.QueryString["propertytype"];
properties = (Request.QueryString["propertytype"] != null) ? properties.Where(x => x.PropertyType == searchCriteria) : properties;
Also any strategy to make the multiple search more optimized.