Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @model IEnumerable<AccessorizeForLess.ViewModels.DisplayProductsViewModel>
- @{
- ViewBag.Title = "Index";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- <h2>Index</h2>
- <p>
- @Html.ActionLink("Create New", "Create")
- </p>
- <table class="table">
- @foreach (var item in Model)
- {
- <tr>
- <td>
- @Html.DisplayFor(modelItem => item.Name)<br />
- <img src="@item.Image.ImagePath"/>
- </td>
- <td>
- @Html.DisplayFor(modelItem => item.Price)
- </td>
- <td>
- @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
- @Html.ActionLink("Details", "Details", new { id = item.Id }) |
- @Html.ActionLink("Delete", "Delete", new { id = item.Id })
- </td>
- </tr>
- }
- </table>
- @model IEnumerable<AccessorizeForLess.ViewModels.DisplayProductsViewModel>
- @{
- ViewBag.Title = "Index";
- Layout = "~/Views/Shared/_Layout.cshtml";
- }
- <h2>Products</h2>
- <p>
- @Html.ActionLink("Create New", "Create")
- </p>
- @foreach (var item in Model)
- {
- <div style="float:left; width:25%">
- @Html.DisplayFor(modelItem => item.Name)<br />
- <input id="Hidden1" type="hidden" value="@item.Id" />
- <div>$@Html.DisplayFor(modelItem => item.Price)</div>
- <div><img src="@item.Image.ImagePath" /></div>
- <div> </div>
- <div>Quantity: <input type="text" id="quantity" style="width:50px;" /></div>
- <div>@Html.ActionLink("Details", "Details", new { id = item.Id })</div>
- </div>
- }
- IEnumerable<DisplayProductsViewModel> model = products.Select(p => new DisplayProductsViewModel()
- {
- Id = p.ProductId,
- Name = p.ProductName,
- Image = p.ProductImage,
- Price = string.Format("{0:C}",p.ProductPrice)
- }).ToList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement