I have a class that contains a number of properties of type bool.
public class FilterModel
{
public bool Hotel { get; set; }
public bool Apartment { get; set; }
public bool Guesthouse { get; set; }
}
I am building a LINQ query dynamically based on whether these properties are true or false. For example, if I had an instance of this class and the hotel was set to the truth. I want to generate LINQ query something like
var q = from accom in db.Accommodation
where accom.Hotel == true
select accom;
Thanks in advance
Barry source
share