title: Filter by date using lambda expression
body: <p>I am jumping into building an ASP.NET MVC site and I am stuck on a probably simple issue. I am attempting to filter a query by date using a lambda expression. The other ways I have attempted to filter have been successful. Here is what I am trying to accomplish. The data is stored in a SQL Server 2008 R2 database with a <code>date</code> data type. I am not sure if this is why the results will not display.</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  using Project.Models;
  
  public class CreateController : Controller
  {
      // GET: Create
      public ActionResult Create()
      {
          var dt = DateTime.Now.AddDays(-10);           
          var db = new Models.Entities();
  
          var apps = db.tableName.Where(x =&gt; x.col1 == dt);                                        
          return View(apps.OrderBy(x =&gt; x.col2));
      }
  }
  </code></pre>
  
  <p>And my view</p>
  
  <pre><code>@model IEnumerable&lt;Project.Models.table1&gt;
  @{
      ViewBag.Title = "Project";
  }
      @foreach (var apps in Model)
      {
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;th&gt;col z&lt;/th&gt;
                  &lt;th&gt;col x&lt;/th&gt;
                  &lt;th&gt;col y&lt;/th&gt;
                  &lt;th&gt;col w&lt;/th&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td&gt;@apps.col1&lt;/td&gt;
                  &lt;td&gt;@apps.col2&lt;/td&gt;
                  &lt;td&gt;@apps.col3&lt;/td&gt;
                  &lt;td&gt;@apps.col4&lt;/td&gt;    
  
              &lt;/tr&gt; 
          &lt;/table&gt;
      }
  </code></pre>