title: ASP.NET foreach do not show items
body: <p>When I select Date in DateTimePicker, it's invoking <code>public ActionResult Index(DateTime? test)</code>. It returns some items into the view, but those items do not appear on Index. It seems that this does not work, and I'm unsure why:</p>
  
  <pre><code>&lt;h1&gt;Items&lt;/h1&gt;
  @foreach (var item in Model)
  {
  &lt;br /&gt;@item.Date
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public class HomeController : Controller
  {
      //
      // GET: /Home/
      public ActionResult Index()
      {
          List&lt;Table&gt; temp = new List&lt;Table&gt;();
          return View(temp);
      }
  
      [HttpPost]
      public ActionResult Index(DateTime? test)
      {
          masterEntities m = new masterEntities();
          List&lt;Table&gt; temp = m.Table.Where(key =&gt; key.Date == test).Select(key =&gt; key).ToList();
          return View(temp);
      }
  }
  </code></pre>
  
  <p>Index.cshtml:</p>
  
  <pre><code>@model IEnumerable&lt;DatePicker.Models.Table&gt;
  
  @{
  ViewBag.Title = "Index";
  }
  &lt;script src="~/Scripts/jquery-2.2.0.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/moment.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/bootstrap-datetimepicker.min.js"&gt;&lt;/script&gt;
  
  &lt;link href="~/Content/bootstrap.min.css" rel="stylesheet" /&gt;
  &lt;link href="~/Content/bootstrap-datetimepicker.min.css" rel="stylesheet" /&gt;
  
  &lt;div class="container"&gt;
  &lt;div class="row"&gt;
      &lt;div class='col-sm-6'&gt;
          &lt;div class="form-group"&gt;
              &lt;div class='input-group date' id='datetimepicker1'&gt;
                  &lt;input type='text' class="form-control" /&gt;
                  &lt;span class="input-group-addon"&gt;
                      &lt;span class="glyphicon glyphicon-calendar"&gt;&lt;/span&gt;
                  &lt;/span&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;script type="text/javascript"&gt;
          $('#datetimepicker1').datetimepicker({ useCurrent: false });
          $('#datetimepicker1').on("dp.hide", function (e) {
              //var temp = $('#datetimepicker1').data('DateTimePicker').date().format('YYYY-MM-DD HH:mm')
              $.ajax({
                  url: "/Home/Index",
                  type: "POST",
                  data: { test: $('#datetimepicker1').data('DateTimePicker').date().format('YYYY-MM-DD HH:mm') },
                  //data: {test: temp },
              });
          });
      &lt;/script&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;h1&gt;Items&lt;/h1&gt;
  @foreach (var item in Model)
  {
  &lt;br /&gt;@item.Date
  }
  </code></pre>