title: MVC5 Delete button error code
body: <p>I am working in MVC5.  I have a functioning .mdf in dbContext.  It produces data in the following table.  The Delete button prints out but gives the error below when pressed:</p>
  
  <p>Index.cshtml</p>
  
  <pre><code>&lt;center&gt;
  &lt;table&gt;
      &lt;tr&gt;&lt;td align="center"&gt;testID&lt;/td&gt;&lt;td align="center"&gt;datetime&lt;/td&gt;&lt;td align="center"&gt;col1&lt;/td&gt;&lt;td align="center"&gt;col2&lt;/td&gt;&lt;td align="center"&gt;col3&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
      @foreach (var item in Model.thistable)
      {
          &lt;tr&gt;&lt;td&gt;@item.testID&lt;/td&gt;&lt;td&gt;@item.datetime&lt;/td&gt;&lt;td&gt;@item.col1&lt;/td&gt;&lt;td&gt;@item.col2&lt;/td&gt;&lt;td&gt;@item.col3&lt;/td&gt;&lt;td&gt;&lt;form action="@Url.Action("Delete", new{ testID = @item.testID})" method="delete"&gt;&lt;input type="submit" value="Delete" /&gt;&lt;/form&gt;&lt;/td&gt;&lt;/tr&gt;
      }
  &lt;/table&gt;
  &lt;/center&gt;
  </code></pre>
  
  <p>HomeController.cs</p>
  
  <pre><code>public class HomeController : Controller
  {
      private testContext db = new testContext();
      private UserViewModel uvm = new UserViewModel();
      public ActionResult Index()
      {
          try
          {
              List&lt;Table1&gt; thattable = db.Data1.ToList();
              uvm.thistable = thattable;
          }
          catch (Exception ex)
          {
              uvm.errorcode = ex.ToString();
          }
  
          return View(uvm);
      }
      public ActionResult Delete(int testID)
      {
          uvm.thistable.Remove(uvm.thistable.SingleOrDefault(o =&gt; o.testID == testID));
          db.SaveChanges(); 
          return View();
      }
  
  public class Table1
  {
      [Key]
      public int testID { get; set; }
      public string datetime { get; set; }
      public string col1 { get; set; }
      public string col2 { get; set; }
      public string col3 { get; set; }
  }
  public class UserViewModel
  {
      public string errorcode { get; set; }
      public List&lt;Table1&gt; thistable { get; set; }
  }
  public class testContext : DbContext
  {
      public DbSet&lt;Table1&gt; Data1 { get; set; }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Error code:</p>
  
  <pre><code>The parameters dictionary contains a null entry for parameter 'testID' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Delete(Int32)' in 'MDFtoMVCdelete.Controllers.HomeController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
  Parameter name: parameters 
  </code></pre>