title: MVC NullReferenceException
body: <p>When I am sending information to the Database in MVC and I am redirecting the page and calling the view which prints out the newly stored data, I get a NullReferenceException error:</p>
  
  <p>"Object reference not set to an instance of an object."</p>
  
  <p>Apparently, my Model is null:</p>
  
  <pre><code>@foreach (var item in Model) {
  &lt;tr&gt;
      &lt;td&gt;
          @Html.DisplayFor(modelItem =&gt; item.Name)
      &lt;/td&gt;
      &lt;td&gt;
          @Html.DisplayFor(modelItem =&gt; item.CustomerID)
      &lt;/td&gt;
      &lt;td&gt;
          @Html.DisplayFor(modelItem =&gt; item.Address)
      &lt;/td&gt;
      &lt;td&gt;
          @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
          @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
          @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
      &lt;/td&gt;
  &lt;/tr&gt;
  }
  </code></pre>
  
  <p>This is my Controller:</p>
  
  <pre><code>public ActionResult Index()
      {
          var customer = db.Customer.ToList();
          return View();
      }
  </code></pre>
  
  <p>Which gets called by:</p>
  
  <pre><code>        [HttpPost]
      public ActionResult Create(CustomerModel customer)
      {
          db.Customer.Add(customer);
          db.SaveChanges();
          return RedirectToAction("Index");
      }
  </code></pre>
  
  <p>I don't understand why it's null....</p>