title: How to pass id from view to Action on a controller
body: <p>I am trying to devise a way to add and remove posts from a web log. So far I have the following code in my view. </p>
  
  <pre><code>@foreach (Comment comment in comments.OrderBy(x =&gt; x.CommentCreateDate))
  {
  
      &lt;div&gt;
          @Html.DisplayFor(modelItem =&gt; comment.CommentId)&lt;br/&gt;
          @Html.DisplayFor(modelItem =&gt; comment.CommentCreateDate)&lt;br /&gt;
          @Html.DisplayFor(modelItem =&gt; comment.CommentUpdateDate)&lt;br /&gt;
          @Html.DisplayFor(modelItem =&gt; comment.CommeterName)&lt;br/&gt;
          @Html.DisplayFor(modelItem =&gt; comment.EmailAddress)&lt;br/&gt;
          @Html.DisplayFor(modelItem =&gt; comment.CommentText)&lt;br /&gt;
          @Html.CheckBoxFor(modelItem =&gt; comment.Approved)
  &lt;/div&gt;
      &lt;hr /&gt;
  
  
  }
  
  @*@Html.ActionLink("Delete", "Delete", new { id = post.PostId }) |*@
  
  
  &lt;form method="get" action="ApproveComment"&gt;
      &lt;input type="submit" id="btnApproveComment" class="btn-default" value="Approve" /&gt;
      &lt;input type="submit" id="btnDelete" class="btn-default" value="Delete" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Then in my Action I have as follows:</p>
  
  <pre><code>//[HttpGet]
          public ActionResult ApproveComment(int id)
          {
  
              bool isChecked = false;
              Comment comment = new Comment();
  
              if (Request.Form["chkApprove"] != null)
              {
                  isChecked = Convert.ToBoolean((Request.Form["chkApprove"]));
              }
  
              comment.CommentId = id;
              comment.Approved = isChecked;
              db.Comments.Add(comment);
              db.SaveChanges();
  
              return View("Admin");
          }
  </code></pre>
  
  <p>My Comment Model:</p>
  
  <pre><code>public class Comment
      {
  
          // Comments have id, poast, id, time, email, comment,
          [Key]
          public int CommentId { get; set; }
          public int PostId { get; set; }
  
          [ForeignKey("PostId")]
          public virtual Post Post{get; set;}
          public string CommentCreateDate { get; set; }
          public string CommentUpdateDate { get; set; }
          public string CommeterName { get; set; }
          public string EmailAddress { get; set; }
          public string CommentText { get; set; }
          public bool Approved { get; set; }
      }
  </code></pre>
  
  <p>My Post model:</p>
  
  <pre><code>public class Post
  {
      [Key]
      public int PostId { get; set; }
      public string Title { get; set; }
      public DateTime CreatedDate{get;set;}
      public DateTime UpdateDate { get; set; }
      public string Body { get; set; }
      public ICollection&lt;Comment&gt; Comments { get; set;}
      /// &lt;summary&gt;
      /// tag has posts and posts have tag -
      /// &lt;/summary&gt;
      public ICollection&lt;Tag&gt; Tags { get; set; }
  
  }
  </code></pre>
  
  <p>What I want really is be able to choose the comments with the Check box and then either delete or approve a comment. For this I need to pass the ID and while I see that I can do that with Action Link I don’t want a link, just to pass the ID and the value of the check box.</p>
  
  <p>Can anyone help?</p>
  
  <p>Thank you!</p>