title: how to pass optional parameter in linq where condition
body: <p>I have a action in MVC controller</p>
  
  <pre><code>public ActionResult ExportExcel(string ReportType,DateTime? FromDate,DateTime? ToDate)
  {
       var query = UnitOfWork.RepoTestResAnalysis.GetAll();
       var QueryData = query.Where(s =&gt; s.MSO == ms &amp;&amp; (FromDate != null &amp;&amp; (s.TEST_DATE.Value &gt;= FromDate)) &amp;&amp; (ToDate!=null &amp;&amp; (s.TEST_DATE.Value&lt;=ToDate))).ToList();
  }
  </code></pre>
  
  <p>Now If <code>FromDate</code> and <code>ToDate</code> are null then I am getting <code>QueryData</code> Count is Zero. But I need all records. So Can anyone tell me how can I get expected result. While <code>FromDate</code> &amp; <code>ToDate</code> has value then I am getting expected result. </p>