I have this linq query that filters using a dropdown select list. The filter works, however, i would like to select all the fields from the table where a city is null. this criteria gives empty results set. which is wrong as there are over 100 entries with no cities.
my model has this:
public class classA
{
public string city {get; set;}
public ClassB somethingfromClassB{get; set;}
}
public class classB
{
//get set methods here
}
controller for class A looks like this:
public class classA : controller
{
public actionresult index()
{
//everything here works except this linq gives me an empty result sets:
var a = db.classA.inlcude(t=>t.somethingfromClassB);
if(value =="")
{
a=db.classA.where(u=>u.city==null).inlcude(t=>t.somethingfromClassB);
}
return view(a.tolist())
}
}