Basically I have an HTML form with about 20 fields. I create an object based on what the user entered on the form and what he did not enter, I set it to null. I want to get things that match on the database
I currently have something simple like:
IQueryable<Item> query = context.Items;
if (i.Height!=null) //i is the item from the HTML form
{
query = query.Where(c => c.Height == i.Height);
}
This currently gives me all of the items that match just the height field that the user gave. I need to gather just the items that match the user description, ALL of the descriptions on the HTML form
I can't think of a way of doing this without a huge block of conditional logic. How would I do this?