title: How to pass model in MVC view
body: <p>I want to pass model from form to controler and show others models in the same view. How can I do this? My main problem is: how to send into testAcc actionresult, model CommentModel, and show text in <code>ViewData["Success"]</code> ?</p>
  
  <p>Here is my code:</p>
  
  <pre><code>    @model XYZ.Models._ideaDetailsWrapper
      @using XYZ.Tools   
  &lt;article&gt;
      &lt;h2&gt;@Model.idea.Tilte&lt;/h2&gt;
  
  &lt;table&gt;&lt;tr&gt;&lt;td&gt;
  &lt;p&gt;
      Author: &lt;b&gt;@UserTools.getUser(Model.idea.AuthorID).UserName&lt;/b&gt;&lt;br /&gt;
      Add date: @Model.idea.AddDate&lt;br /&gt;
      Category: @IdeasTools.getCategoryName(Model.idea.CategoryID)&lt;br /&gt;
  &lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;&lt;/table&gt;
  
  &lt;p&gt;&lt;b&gt;Content:&lt;/b&gt;&lt;br /&gt;
      @Model.idea.Content&lt;/p&gt;
  
  &lt;br /&gt;&lt;br /&gt;
  
  // HERE - ADD comment
  
      @using (Html.BeginForm("testAcc", "Ideas", FormMethod.Post))
      { 
              &lt;h4&gt;Add comment:&lt;/h4&gt;
  
              @Html.LabelFor(m =&gt; m.addComment.Content)
              @Html.EditorFor(m =&gt; m.addComment.Content)&lt;br /&gt;
          &lt;input type="submit" value="SendEmails" /&gt;
      }
  
  @ViewData["Success"]
  </code></pre>
  
  <p></p>
  
  <p>wrapper:</p>
  
  <pre><code>public class _ideaDetailsWrapper 
  {
      public Ideas idea { get; set; }
      public IEnumerable&lt;IdeasComment&gt; commentList { get; set; }
      public CommentModel addComment { get; set; }
  }
  </code></pre>
  
  <p>Action method:</p>
  
  <pre><code>    [HttpPost]
      [Authorize]
      public ActionResult testAcc(CommentModel model)
      {
  
          CommentModel abs = model;
  
          ViewData["Success"] = "Working!";
  
          // ADD TO DATABASE, but model is null..
          return RedirectToAction("Details", "Ideas");
      }
  </code></pre>