I hope anyone can help me I am trying to submit a single object from a list, but I can't seem to get any information over.
@using System.Activities.Statements
@using NET_MVC_Application.Models
@{
ViewBag.Title = "Index";
}
@model TweakersRemake.Models.ProductViewModel
<h2>Index</h2>
<div>
@using (Html.BeginForm("Prijzen", "Product", FormMethod.Post))
{
foreach (Product p in Model.Products)
{
<div>
@{
Product Pro = new Product();
Pro = p;
}
@Html.Hidden("Id",Pro.Id)
@Html.LabelFor(m => Pro.Catergorie) : @Html.DisplayFor(m => Pro.Catergorie) <br/>
@Html.LabelFor(m => Pro.Naam) : @Html.DisplayFor(m => Pro.Naam)<br/>
@Html.LabelFor(m => Pro.Foto_Url) : @Html.DisplayFor(m => Pro.Foto_Url)<br/>
<button type="submit">Prijzen</button>
</div>
}
}
</div>
This I my layout, I Can send the individual information Like that Id but not the product, I also used p as the model inside the Html helpers
[HttpPost]
public ActionResult Prijzen(ProductViewModel model, int? Id, Product Pro)
{
return View(model.Products.Find(m => m.Id == Id));
}
So I am trying to get the single product, I hope anyone can help me.