title: linq to sql query with multiple where parameters
body: <p>I'm currently writing a search function in ASP.NET MVC 4 with the Entity Framework. However, I've hit a roadblock for which I can only find "bad" solutions.</p>
  
  <p>My search functions gets back a model which consists of 4 parameters:</p>
  
  <pre><code>String Name
  String Street
  String Code
  String Province
  
  List&lt;Query&gt; query = (from t in Model select t).ToList();
  </code></pre>
  
  <p>Now I'd like to filter on my search input. However, a user can decide to fill in as many search fields as possible. He can decide to use Name and Street, or Name, Street and Province, or ...</p>
  
  <p>The only real solution I was able to find consists of making my query and <code>IQueryable</code> and check whether or not a field has been filled with an <code>if</code>, then use a <code>.Where</code> to update the query.
  As this would currently give m 5 queries, I'm wondering on whether or not there is a better solution that I'm missing here.</p>
  
  <p>Thanks for helping me.</p>