title: ASP.NET MVC 3 Adding comments in article view
body: <p>I have article model with  <code>public ICollection&lt;Comment&gt; Comments { get; set; }</code> and comment model. I have created view for article (Details view) and I want to show everything from model article (not problem) and comments to article to and after comments then show form for adding comment to article (not in other page, I want it in the view with article). For now I have this:</p>
  
  <pre><code>@model SkMoravanSvitavka.Models.Article
  
  @{
      ViewBag.Title = "Zobrazit";
  }
  
  &lt;h2&gt;Zobrazit&lt;/h2&gt;
  
  &lt;fieldset&gt;
      &lt;legend&gt;Article&lt;/legend&gt;
  
      &lt;div class="display-label"&gt;Title&lt;/div&gt;
      &lt;div class="display-field"&gt;@Model.Title&lt;/div&gt;
  
      &lt;div class="display-label"&gt;Text&lt;/div&gt;
      &lt;div class="display-field"&gt;@Model.Text&lt;/div&gt;
  
      &lt;div class="display-label"&gt;PublishedDate&lt;/div&gt;
      &lt;div class="display-field"&gt;@String.Format("{0:g}", Model.PublishedDate)&lt;/div&gt;
  &lt;/fieldset&gt;
  
  @if (Model.Comments != null)
  {
      foreach (var comment in Model.Comments)
      {
          @Html.Partial("_Comment", comment)
      }
  }
  
  
  
  &lt;p&gt;
      @Html.ActionLink("Edit", "Edit", new { id = Model.ArticleID }) |
      @Html.ActionLink("Back to List", "Index")
  &lt;/p&gt;
  </code></pre>
  
  <p>It shows article and there is partial view for all comments to article. And now I am not sure how to add form for adding comments. Thank you</p>
  
  <p><strong>Edit</strong>: Here is my comment controller and create methods (vytvorit = create in czech :) ):</p>
  
  <pre><code> public ActionResult Vytvorit(int articleID)
          {
              var newComment = new Comment();
              newComment.articleID = articleID; // this will be sent from the ArticleDetails View, hold on :).
             newComment.Date = DateTime.Now;
              return View(newComment);  
          } 
  
          [HttpPost]
          public ActionResult Vytvorit(Comment commentEntity)
          {
                  db.Comments.Add(commentEntity);
                  db.SaveChanges();
                  return RedirectToAction("Zobrazit", "Clanek", new { id = commentEntity.articleID });
          }
  </code></pre>
  
  <p>When I change <code>@Html.RenderAction</code> to <code>@Html.Action</code> it works. It is showing textbox for comment and I can add comment but there is problem that it not just add textbox but it add my site again (not just partial view but all view) and I am sure I add Create view for comment as partial.</p>