在这里,我在我的 ViewModel 中迭代产品:
@foreach (var p in Model.Products)
{
Html.RenderPartial("ProductSummary", p);
<p>@Html.ActionLink("Details...", "Details", "Product", new { p.ProductID }, null)</p>
}
这是我在 ProductController 中的详细信息操作:
public ActionResult Details(int id = 1)
{
return View();
}
id
总是有一个默认值 = 1,但我需要选择的ProductID
. 我究竟做错了什么?