lambda expression Problems
<p>My question is when I click actionlink,the view send specific ID to controller(ex. ProductID = 6), but my controller grab all data to me not specific ID data.</p>

<p>I think the problem is the lambda expression at controller, it will grab all data to me.</p>

<p>These are my 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>        [HttpGet]
        public ActionResult EditFromCart(int ProductID)
        {

            ShoppingCart cart = GetCart();
            cart.items.Where(r =&gt; r.Product.ProductID == ProductID)
                      .Select(r =&gt; new  ShoppingCartItemModel
                                        {
                                            Product = r.Product,
                                            Quantity = r.Quantity
                                        });

            return View(cart);

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


        private ShoppingCart GetCart()
        {
            ShoppingCart cart = (ShoppingCart)Session["Cart"];

            //如果現有購物車中已經沒有任何內容
            if (cart == null)
            {
                //產生新購物車物件
                cart = new ShoppingCart();

                //用session保存此購物車物件
                Session["Cart"] = cart;
            }

            //如果現有購物車中已經有內容,就傳回 view 顯示
            return cart;
        }
</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;
        @foreach (var item in Model.items)
        {
            &lt;tr&gt;
                &lt;td class="text-center"&gt;
                    @item.Quantity
                &lt;/td&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&gt;
                    @using (Html.BeginForm("RemoveFromCart", "ShoppingCart"))
                    {
                        @Html.Hidden("ProductId", item.Product.ProductID)
                        @*@Html.HiddenFor(x =&gt; x.ReturnUrl)*@
                        &lt;input class="btn btn-warning" type="submit" value="Remove"&gt;
                    }
                &lt;/td&gt;
                &lt;td&gt;
                    @using (Html.BeginForm("EditFromCart", "ShoppingCart", FormMethod.Get))
                    {
                        @Html.Hidden("ProductId", item.Product.ProductID)
                        &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>