Advertisement
Guest User

Untitled

a guest
Jul 21st, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. @model IEnumerable<AccessorizeForLess.ViewModels.DisplayProductsViewModel>
  2.  
  3. @{
  4. ViewBag.Title = "Index";
  5. Layout = "~/Views/Shared/_Layout.cshtml";
  6. }
  7.  
  8. <h2>Index</h2>
  9.  
  10. <p>
  11. @Html.ActionLink("Create New", "Create")
  12. </p>
  13. <table class="table">
  14. @foreach (var item in Model)
  15. {
  16. <tr>
  17. <td>
  18. @Html.DisplayFor(modelItem => item.Name)<br />
  19. <img src="@item.Image.ImagePath"/>
  20. </td>
  21. <td>
  22. @Html.DisplayFor(modelItem => item.Price)
  23. </td>
  24. <td>
  25. @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
  26. @Html.ActionLink("Details", "Details", new { id = item.Id }) |
  27. @Html.ActionLink("Delete", "Delete", new { id = item.Id })
  28. </td>
  29. </tr>
  30. }
  31.  
  32. </table>
  33.  
  34. @model IEnumerable<AccessorizeForLess.ViewModels.DisplayProductsViewModel>
  35.  
  36. @{
  37. ViewBag.Title = "Index";
  38. Layout = "~/Views/Shared/_Layout.cshtml";
  39. }
  40.  
  41. <h2>Products</h2>
  42.  
  43. <p>
  44. @Html.ActionLink("Create New", "Create")
  45. </p>
  46. @foreach (var item in Model)
  47. {
  48. <div style="float:left; width:25%">
  49. @Html.DisplayFor(modelItem => item.Name)<br />
  50. <input id="Hidden1" type="hidden" value="@item.Id" />
  51. <div>$@Html.DisplayFor(modelItem => item.Price)</div>
  52. <div><img src="@item.Image.ImagePath" /></div>
  53. <div>&nbsp;</div>
  54. <div>Quantity: <input type="text" id="quantity" style="width:50px;" /></div>
  55. <div>@Html.ActionLink("Details", "Details", new { id = item.Id })</div>
  56. </div>
  57. }
  58.  
  59. IEnumerable<DisplayProductsViewModel> model = products.Select(p => new DisplayProductsViewModel()
  60. {
  61. Id = p.ProductId,
  62. Name = p.ProductName,
  63. Image = p.ProductImage,
  64. Price = string.Format("{0:C}",p.ProductPrice)
  65. }).ToList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement