title: Linq Where Clause Change based on Parameters
body: <p>I have a linq statement that returns a list of records based on where clause <br />
  This where clause checks for two parameter values.
  <br />
  Out of which one parameter is optional.<br />
  so i need a suggestions if i can switch my where clause based  on the optional Parameter<br />
  something like this</p>
  
  <pre><code>if(locid==0)
    {
     where (p.CustomerID == custid)
    }
   else{
     where (p.CustomerID == custid) &amp; (p.LocationID == locid )
       }
  </code></pre>
  
  <p>can any one help me how can i get this work.</p>
  
  <p>thanks</p>