Guest User

Untitled

a guest
Nov 3rd, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.17 KB | None | 0 0
  1. @model WeAreNotGoodFoodVerCore2.Models.Restaurant
  2.  
  3. @{
  4. ViewData["Title"] = "Details";
  5. }
  6.  
  7. <h2>Details</h2>
  8.  
  9. <div>
  10. <h4>Restaurant</h4>
  11. <hr />
  12. <dl class="dl-horizontal">
  13. <dt style=" width: 20%; color: darkslategrey">
  14. <h4 style=" width: 10%; color: darkslategrey">Название заведения</h4>
  15. </dt>
  16. <dd>
  17. <h4 style="width: 50%; color: brown"> @Html.DisplayFor(model => model.Name)</h4>
  18. </dd>
  19. <hr />
  20. <dt style=" width: 20%; color: darkslategrey">
  21. <h4 style=" width: 10%; color: darkslategrey"> Изображение</h4>
  22. </dt>
  23. <dd>
  24. <img src="~/@Model.ImagesRestaurant" width="550" height="350" />
  25. </dd>
  26. <hr />
  27. <dt style=" width: 20%; color: darkslategrey">
  28. <h4 style=" width: 20%; color: darkslategrey"> @Html.DisplayNameFor(model => model.Description)</h4>
  29. </dt>
  30. <dd>
  31. <h4 style=" width: 50%; color: darkslategrey"> @Html.DisplayFor(model => model.Description)</h4>
  32. </dd>
  33. <hr />
  34. <dt style=" width: 20%; color: darkslategrey">
  35. <h4 style=" width: 10%; color: darkslategrey">Имя владельца</h4>
  36. </dt>
  37. <dd>
  38. <h4 style=" width: 10%; color: brown">@Html.DisplayFor(model => model.User.Name)</h4>
  39. </dd>
  40. </dl>
  41. </div>
  42. <div>
  43. <a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
  44. <a asp-action="Index">Back to List</a>
  45. </div>
  46.  
  47. @model IEnumerable<WeAreNotGoodFoodVerCore2.Models.Dish>
  48.  
  49. @{
  50. ViewData["Title"] = "Index";
  51. }
  52.  
  53. <h2>Все блюда</h2>
  54.  
  55. <p>
  56. <h4 style="color: darkslategrey"> <a asp-action="Create">Добавить блюдо</a></h4>
  57. </p>
  58. <table class="table table-bordered">
  59. <thead>
  60. <tr style="width: auto">
  61. <th style="width: 10%; color: darkgray">Название</th>
  62. <th style="width: 60%; color: darkgray">Вид</th>
  63. <th style="width: 20%; color: darkgray">Цена</th>
  64. <th style="width: 5%; color: darkgray">Описание</th>
  65. <th style="width: 5%; color: darkgray">Название ресторана</th>
  66. <th></th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. @foreach (var item in Model) {
  71. <tr>
  72. <td>
  73. <h4 style="color: darkslategrey">@Html.DisplayFor(modelItem => item.NameDish)</h4>
  74. </td>
  75. <td>
  76. <img src="~/@item.ImagesDish" width="550" height="350" />
  77. </td>
  78. <td>
  79. <h4 style="color: brown">@Html.DisplayFor(modelItem => item.Price) .com</h4>
  80. </td>
  81. <td>
  82. <h4 style="color: darkgray">@Html.DisplayFor(modelItem => item.Description) </h4>
  83. </td>
  84. <td>
  85. <h4 style="color: darkslategrey">@Html.DisplayFor(modelItem => item.Restaurant.Name)</h4>
  86. </td>
  87. <form asp-area="" asp-controller="Dishes" asp-action="AddShoppingCart">
  88. <div class="form-group">
  89. <input type="submit" value="AddCart" class="btn btn-default"/>
  90. </div>
  91. </form>
  92. <td>
  93. <a asp-action="Edit" asp-route-id="@item.Id" style="color: cadetblue">Edit</a> <br />
  94. <a asp-action="Details" asp-route-id="@item.Id" style="color: cadetblue">Details</a> <br />
  95. <a asp-action="Delete" asp-route-id="@item.Id" style="color: cadetblue">Delete</a> <br />
  96. </td>
  97. </tr>
  98.  
  99. }
  100. </tbody>
  101. </table>
  102.  
  103. // GET: Restaurants/Details/5
  104. public async Task<IActionResult> Details(int? id)
  105. {
  106. if (id == null)
  107. {
  108. return NotFound();
  109. }
  110.  
  111. var restaurant = await _context.Restaurants
  112. .Include(r => r.User)
  113. .SingleOrDefaultAsync(m => m.Id == id);
  114. if (restaurant == null)
  115. {
  116. return NotFound();
  117. }
  118.  
  119. return View(restaurant);
  120. }
  121.  
  122. // GET: Dishes
  123. public async Task<IActionResult> Index()
  124. {
  125. var applicationDbContext = _context.Dishes
  126. .Include(d => d.Restaurant)
  127. .OrderByDescending(r => r.Id);
  128.  
  129. return View(await applicationDbContext.ToListAsync());
  130. }
  131.  
  132. @model IEnumerable<WeAreNotGoodFoodVerCore2.Models.Dish>
  133.  
  134. @{
  135. ViewData["Title"] = "Index";
  136. }
  137.  
  138. <h2>Все блюда</h2>
  139.  
  140. <p>
  141. <h4 style="color: darkslategrey"> <a asp-action="Create">Добавить блюдо</a></h4>
  142. </p>
  143. <table class="table table-bordered">
  144. <thead>
  145. <tr style="width: auto">
  146. <th style="width: 10%; color: darkgray">Название</th>
  147. <th style="width: 60%; color: darkgray">Вид</th>
  148. <th style="width: 20%; color: darkgray">Цена</th>
  149. <th style="width: 5%; color: darkgray">Описание</th>
  150. <th style="width: 5%; color: darkgray">Название ресторана</th>
  151. <th></th>
  152. </tr>
  153. </thead>
  154. <tbody>
  155. </tbody>
  156. </table>
  157. @foreach (var item in Model) {
  158. @Html.Partial("_PartialViewDish", item)
  159. }
  160.  
  161. @model Dish
  162.  
  163. <tr>
  164. <td>
  165. <h4 style="color: darkslategrey">@Html.DisplayFor(modelItem => item.NameDish)</h4>
  166. </td>
  167. <td>
  168. <img src="~/@item.ImagesDish" width="550" height="350" />
  169. </td>
  170. <td>
  171. <h4 style="color: brown">@Html.DisplayFor(modelItem => item.Price) .com</h4>
  172. </td>
  173. <td>
  174. <h4 style="color: darkgray">@Html.DisplayFor(modelItem => item.Description) </h4>
  175. </td>
  176. <td>
  177. <h4 style="color: darkslategrey">@Html.DisplayFor(modelItem => item.Restaurant.Name)</h4>
  178. </td>
  179. <form asp-area="" asp-controller="Dishes" asp-action="AddShoppingCart">
  180. <div class="form-group">
  181. <input type="submit" value="AddCart" class="btn btn-default"/>
  182. </div>
  183. </form>
  184. <td>
  185. <a asp-action="Edit" asp-route-id="@item.Id" style="color: cadetblue">Edit</a> <br />
  186. <a asp-action="Details" asp-route-id="@item.Id" style="color: cadetblue">Details</a> <br />
  187. <a asp-action="Delete" asp-route-id="@item.Id" style="color: cadetblue">Delete</a> <br />
  188. </td>
  189. </tr>
Add Comment
Please, Sign In to add comment