@using ComputerStoreContracts.ViewModels

@model List<ProductViewModel>

@{
    ViewData["Title"] = "Товары";
}

<div class="text-center">
    <h1 class="display-4">Товары</h1>
</div>

<div class="text-center">
    <p>
        <a asp-action="CreateProduct" class="nav-link">Создать товар</a>
    </p>
    <table class="table">
        <thead>
            <tr>
                <th>Номер</th>
                <th>Название товара</th>
                <th>Цена</th>
                <th>Категория</th>
                <th>Изменить товар</th>
                <th>Удалить товар</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@Html.DisplayFor(modelItem => item.Id)</td>
                    <td>@Html.DisplayFor(modelItem => item.ProductName)</td>
                    <td>@Html.DisplayFor(modelItem => item.Price)</td>
                    <td>@Html.DisplayFor(modelItem => item.Category)</td>
                    <td>
                        <a asp-action="CreateProduct" asp-route-id="@item.Id" class="btn btn-primary">Изменить</a>
                    </td>
                    <td>
                        <a asp-action="DeleteProduct" asp-route-id="@item.Id" class="btn btn-danger">Удалить</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>