title: Entity Framework - Date Range
body: <p>I have a MVC application with a grid on the view.  The user is allowed to filter the data on the grid using different information.  One way is to use two datepickers for date range (min/max).  I attempting to find all matching datasets in the business logic.  But for some reason the date range always returns a empty set.  I know I don't have it coded right, but not sure what to change.  This is the code -</p>
  
  <pre><code>filteredbyCustCriteria = _unitOfWork.CustomerRepository.Get.Where
  (w =&gt; (reportSearch.FullName != null ? (w.FirstName + " " + w.LastName).Contains(reportSearch.FullName.Trim()) : true)
  &amp;&amp; (reportSearch.MinPaidDate != null ? EntityFunctions.TruncateTime(w.Orders.FirstOrDefault().OrderPayments.FirstOrDefault().PaymentDate) &gt;= reportSearch.MinPaidDate : true)
  &amp;&amp; (reportSearch.MaxPaidDate != null ? EntityFunctions.TruncateTime(w.Orders.FirstOrDefault().OrderPayments.FirstOrDefault().PaymentDate) &lt;= reportSearch.MaxPaidDate : true));
  </code></pre>
  
  <p>It works find on the fullname.</p>