title: Add to list mvc
body: <p>I'm trying to add string data to list, but have null reference exception and don't have any idea how to fix this.</p>
  
  <p>Here home controller: </p>
  
  <pre><code>public ActionResult Index()
  {
      return View();
  }
  
  [HttpPost]
  public ActionResult Index(ChatUser model)
  {
      if (ModelState.IsValid)
      {
          **model.chatGroup.Add(model.inputGroups);**  - here excepton 
      }
      return View(model);
  }
  </code></pre>
  
  <p>And Index.cshtml: </p>
  
  <pre><code>@model test.Models.ChatUser
  @{
      ViewBag.Title = "Test";
  }
  
  &lt;h2&gt;@ViewBag.Title.&lt;/h2&gt;
  
  @using (Html.BeginForm("Index", "Home", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
  {
      &lt;div class="form-group"&gt;
          @Html.LabelFor(m =&gt; m.inputGroups, new { @class = "col-md-2 control-label" })
          &lt;div class="col-md-10"&gt;
              @Html.TextBoxFor(m =&gt; m.inputGroups, new { @class = "form-control" })
              &lt;input type="submit" value="GO" class="btn btn-default" /&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
  }
  
  @section Scripts {
      @Scripts.Render("~/bundles/jqueryval")
  }
  </code></pre>