title: View not passing Id to controller
body: <p>I'm trying to get a Id of item from view so that I can delete it from db.
  Here is my model</p>
  
  <pre><code> public class ModuleVM
      {
          public long Id { get; set; }
          public string ModuleId { get; set; }
          public string TypeName { get; set; }
  
          [DataType(DataType.DateTime)]
          public DateTime DateEntered { get; set; }
      }
      public class IndexModule
      {
          public List&lt;ModuleVM&gt; Modules { get; set; }
      }
  </code></pre>
  
  <p>Here is method from controller that shows all the items from table</p>
  
  <pre><code>  public ActionResult ModuleList()
      {
          var modulesList = new IndexModule();
  
          var modules = (from module in _db.Modules
                         orderby module.DateEntered
                         select new ModuleVM
                         {
                             Id = module.Id,
                             ModuleId = module.ModuleId,
                             TypeName = module.ModuleType.TypeName,
                             DateEntered = module.DateEntered
                         });
          modulesList.Modules = modules.ToList();
  
          return View(modulesList);
      }
  </code></pre>
  
  <p>And now the view</p>
  
  <pre><code>        @using BootstrapSupport
  @model AdminPortal.Areas.Hardware.Models.IndexModule
  @{
      ViewBag.Title = "Index";
      Layout = "~/Views/shared/_BootstrapLayout.basic.cshtml";
  }
  &lt;p&gt;
      @Html.ActionLink("Create New", "CreateModule", null, new {@class = "btn"})
  &lt;/p&gt;
  &lt;table class="table table-striped"&gt;
      &lt;caption&gt;&lt;/caption&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;ID&lt;/th&gt;
              &lt;th&gt;Module Id&lt;/th&gt;
              &lt;th&gt;Module type&lt;/th&gt;
              &lt;th&gt;Date Entered&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      @foreach (var entry in Model.Modules)
      {
          &lt;tr&gt;
              &lt;td&gt;@entry.Id&lt;/td&gt;
              &lt;td&gt;@entry.ModuleId&lt;/td&gt;
              &lt;td&gt;@entry.TypeName&lt;/td&gt;
              &lt;td&gt;@entry.DateEntered&lt;/td&gt;
  
              &lt;td&gt;
                  &lt;div class="btn-group"&gt;
                      &lt;a class="btn dropdown-toggle" data-toggle="dropdown" href="#"&gt;
                          Action&lt;span class="caret"&gt;&lt;/span&gt;
                      &lt;/a&gt;
                      &lt;ul class="dropdown-menu"&gt;
                          &lt;li&gt;@Html.ActionLink("Details", "Create")&lt;/li&gt;
                          @if (Request.IsAuthenticated &amp;&amp; HttpContext.Current.User.IsInRole("Admin"))
                          {
                              &lt;li class="divider"&gt;&lt;/li&gt;
                              &lt;li&gt;@Html.ActionLink("Edit", "Edit")&lt;/li&gt;
  
                              &lt;li&gt;@Html.ActionLink("Delete", "DeleteModule","Module", new {Id = entry.Id})&lt;/li&gt;//error probably here
                          }       
  
                      &lt;/ul&gt;
                  &lt;/div&gt;    
              &lt;/td&gt;
          &lt;/tr&gt;
      }
  &lt;/table&gt;
  </code></pre>
  
  <p>and now the delete method</p>
  
  <pre><code>public ActionResult DeleteModule(long Id)
          {
             // Mapper.CreateMap&lt;Sorama.DataModel.SIS.ModuleStock.Module, ModuleVM&gt;();
  
              var moduletypeId = Convert.ToInt64(_db.ModuleTypes.Find(moduleVM.TypeName));
  
              var module = new Sorama.DataModel.SIS.ModuleStock.Module
                  {
                      Id = moduleVM.Id,
                      ModuleId = moduleVM.ModuleId,
                      ModuleTypeId = moduletypeId,
                      DateEntered = moduleVM.DateEntered
                  };
  
              //_db.Modules.Remove(module);//also this shows error, don't know why
              Information("Your widget was deleted");
              return RedirectToAction("ModuleList", "Module", new { area = "Hardware" });
  
         }
  </code></pre>
  
  <p><strong>Edit: as per answer I tried to change my view</strong>
  On Pressing delete action I get this message in browser.</p>
  
  <pre><code>The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int64' for method 'System.Web.Mvc.ActionResult DeleteModule(Int64)' in 'AdminPortal.Areas.Hardware.Controllers.ModuleController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
  Parameter name: parameters
  </code></pre>
  
  <p>How can I pass the Id from my <code>foreach</code> statement from view to controller, when delete is pressed?</p>