title: Asp Mvc post add item to list
body: <p>I start learning asp net. I want show List in table and create new row on this page</p>
  
  <p>i create model</p>
  
  <pre><code>  public class Student
  {
      public string Name { get; set; }
      public string Surname { get; set; }
  
  }
  </code></pre>
  
  <p>Then view</p>
  
  <pre><code>@model IEnumerable&lt;WebApplication1.Models.Student&gt;
  
  &lt;table class="table"&gt;
      &lt;tr&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Name)
          &lt;/th&gt;
          &lt;th&gt;
              @Html.DisplayNameFor(model =&gt; model.Surname)
          &lt;/th&gt;
          &lt;th&gt;&lt;/th&gt;
      &lt;/tr&gt;
  
      @foreach (var item in Model)
      {
          &lt;tr&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.Name)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.DisplayFor(modelItem =&gt; item.Surname)
              &lt;/td&gt;
          &lt;/tr&gt;
      }
  &lt;/table&gt;
  
  
  &lt;div class="form-horizontal"&gt;
      @using (Html.BeginForm())
      {
  
          &lt;div class="form-group"&gt;
              &lt;label class="col-md-2"&gt;Имя&lt;/label&gt;
              @Html.TextBox("name", null, new {@class = "form-control col-lg-4"})
          &lt;/div&gt;
  
          &lt;div class="form-group"&gt;
              &lt;label class="col-md-2"&gt;Фамилия&lt;/label&gt;
              @Html.TextBox("surname", null, new {@class = "form-control col-lg-4"})
          &lt;/div&gt;
          &lt;button type="submit" class="btn btn-default"&gt;Добавить&lt;/button&gt;
      }
  &lt;/div&gt;
  
  &lt;div class="panel-footer"&gt;
      &lt;h3&gt;@ViewBag.Msg&lt;/h3&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And Controller</p>
  
  <pre><code>  List&lt;Student&gt; Students=new List&lt;Student&gt;
      {
          new Student() {Name = "1",Surname = "1"},
          new Student() {Name = "2",Surname = "2"},
          new Student() {Name = "3",Surname = "3"}
      }; 
      // GET: Home
      public ActionResult Index()
      {
          return View(Students);
      }
  
      [HttpPost]
      public ActionResult Index(string name,string surname)
      {
          Students.Add(new Student() {Name = name,Surname = surname});
          @ViewBag.Msg = "User add : " + name +" "+ surname;
          return View(Students);
      }
  </code></pre>
  
  <p>All work good but when i add new row last row recreate(add only one row in my collection). Where i was wrong? sorry for my bad english</p>