Controller can't receive model data : <p>Hi I want to grab all user modify data. </p>

<p>My question is why controller can't receive the model data from View in my project.</p>

<p>Please explain why this error was caused and how to solve it.</p>

<p>Models:</p>

<pre><code> public class ShoppingCart
    {
        public List&lt;ShoppingCartItemModel&gt; items = new List&lt;ShoppingCartItemModel&gt;();

        public IEnumerable&lt;ShoppingCartItemModel&gt; Items
        {
            get { return items; }
        }
    }

  public class ShoppingCartItemModel
    {
        public Product Product
        {
            get;
            set;
        }

        public int Quantity { get; set; }
    }
</code></pre>

<p>Controller </p>

<pre><code> [HttpPost]
        public RedirectToRouteResult EditFromCart(ShoppingCart MyModel)
        {
            ShoppingCart cart = GetCart();

            foreach (var CartItem in cart.items)
            {
                foreach (var ReceiveModelItem in MyModel.items)
                {
                    if (CartItem.Product.ProductID == ReceiveModelItem.Product.ProductID)
                    {
                        CartItem.Quantity = ReceiveModelItem.Quantity;
                    }
                }
            }

            return RedirectToAction("Index", "ShoppingCart");

        }
</code></pre>

<p>View</p>

<pre><code>@model ShoppingCart

@{
    ViewBag.Title = "購物車內容";
}

&lt;h2&gt;Index&lt;/h2&gt;

&lt;table class="table"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
            &lt;th&gt;
                Quantity
            &lt;/th&gt;
            &lt;th&gt;
                Item
            &lt;/th&gt;
            &lt;th class="text-right"&gt;
                Price
            &lt;/th&gt;
            &lt;th class="text-right"&gt;
                Subtotal
            &lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        @using (Html.BeginForm("EditFromCart", "ShoppingCart", FormMethod.Post))
        {
            foreach (var item in Model.items)
            {
                &lt;tr&gt;
                    &lt;td class="text-center"&gt;
                        @item.Product.ProductName
                    &lt;/td&gt;
                    &lt;td class="text-center"&gt;
                        @item.Product.Price.ToString("c")
                    &lt;/td&gt;
                    &lt;td class="text-center"&gt;
                        @( (item.Quantity * item.Product.Price).ToString("c"))
                    &lt;/td&gt;
                    &lt;td class="text-left"&gt;

                        @Html.EditorFor(model =&gt; item.Quantity, null, "UserInputQuantity")

                        @Html.Hidden("ProductId", item.Product.ProductID)
                    &lt;/td&gt;

                &lt;/tr&gt;
            }
            &lt;tr&gt;
                &lt;td colspan="3"&gt;
                    &lt;input class="btn btn-warning" type="submit" value="Edit"&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        }
    &lt;/tbody&gt;
&lt;/table&gt;
</code></pre>
