2024-12-17 14:57:49 +01:00

48 lines
1.3 KiB
Plaintext

@model IEnumerable<WebVentaCoche.Models.Product>
@{
ViewData["Title"] = "Lista de Productos";
}
<h2>Lista de Productos</h2>
<a class="btn btn-primary mb-3" href="@Url.Action("Create", "Products")">Añadir Producto</a>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Nombre</th>
<th>Precio</th>
<th>Acciones</th>
</tr>
</thead>
<tbody>
@foreach (var product in Model)
{
<tr>
<td>@product.Id</td>
<td>@product.Name</td>
<td>@product.Price €</td>
<td>
<a class="btn btn-info" href="@Url.Action("Details", "Products", new { id = product.Id })">Ver</a>
<a class="btn btn-warning" href="@Url.Action("Edit", "Products", new { id = product.Id })">Editar</a>
</td>
</tr>
}
</tbody>
</table>
<div>
<nav>
<ul class="pagination">
@for (int i = 1; i <= ViewBag.TotalPages; i++)
{
<li class="page-item @(ViewBag.CurrentPage == i ? "active" : "")">
<a class="page-link" href="@Url.Action("Index", "Products", new { page = i })">@i</a>
</li>
}
</ul>
</nav>
</div>