CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopEmployeeApp/Views/Home/Index.cshtml
Илья Федотов c2b184de42 Delete & Update is done
2024-05-29 21:45:37 +04:00

65 lines
1.3 KiB
Plaintext

@using ElectronicsShopContracts.ViewModels
@model List<ProductViewModel>
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Товары</h1>
</div>
<div class="text-center">
@{
if (Model == null) {
<h3 class="display-4">Авторизируйтесь</h3>
return;
}
<p>
<a asp-action="CreateProduct">Создать товар</a>
</p>
<table class="table">
<thead>
<tr>
<th>
Номер продукта
</th>
<th>
Название продукта
</th>
<th>
Статья затрат
</th>
<th>
Сумма
</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model) {
<tr>
<th>
@Html.DisplayFor(modelItem => item.ID)
</th>
<th>
@Html.DisplayFor(modelItem => item.ProductName)
</th>
<th>
@Html.DisplayFor(modelItem => item.CostItemName)
</th>
<th>
@Html.DisplayFor(modelItem => item.Price)
</th>
<td>
<a class="btn btn-primary btn-sm" asp-action="EditProduct" asp-route-ID="@item.ID">Изменить</a>
<a class="btn btn-primary btn-sm" asp-action="DeleteProduct" asp-route-ID="@item.ID">Удалить</a>
</td>
</tr>
}
</tbody>
</table>
}
</div>