title: ASP.NET Core 1.0 POST IEnumerable<T> to controller
body: <p>I have an action that returns a model to the View which is <code>IEnumerable&lt;T&gt;</code>. In the view I loop through the list using foreach. T type has a property called Amount.</p>
  
  <p>Now when I click <code>SAVE</code> button, I want to POST the model (IEnumerable) to an action. The IEnumerbale items, their properties <code>Amount</code> should contain the correct values.</p>
  
  <p><a href="https://i.stack.imgur.com/GX4jX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GX4jX.png" alt="enter image description here"></a></p>
  
  <p>When I submit it, in the action, the model is null.</p>
  
  <p>For testing the <code>IEnumerable&lt;T&gt;</code> is <code>IEnumerable&lt;Produt&gt;</code></p>
  
  <pre><code>public class Product
  {
  
      public string Title { get; set; }
      public int Amount { get; set; }
  }
  </code></pre>
  
  <p>view display products:</p>
  
  <pre><code> @model IEnumerable&lt;Product&gt;
  
  
   &lt;form asp-controller="Home" asp-action="Order" method="post" role="form"&gt;
         @foreach (var product in Model)
         {
              &lt;div&gt;
                    &lt;span&gt;@product.Title&lt;/span&gt;
                    &lt;input asp-for="@product.Amount" type="text"&gt;
              &lt;/div&gt;
         }
    &lt;button type="submit"&gt;SAVE&lt;/button&gt;         
  
   &lt;/form&gt;
  </code></pre>
  
  <p>controller post action:</p>
  
  <pre><code>    [HttpPost]    
      public async Task&lt;IActionResult&gt; Order(IEnumerable&lt;Product&gt; model)
      {
  
      }
  </code></pre>