Compare commits

..

2 Commits

Author SHA1 Message Date
maja
b7be9a7689 Merge branch 'main' of https://git.vedetvic.cz/Ondur/Web-Jarmark 2026-10-28 18:09:31 +01:00
maja
ab3b420953 katalog 2026-10-28 18:09:30 +01:00

View File

@@ -1,7 +1,40 @@
@page "/"
@using Microsoft.EntityFrameworkCore
@using Web_Jarmark.Data
@using Web_Jarmark.Data.Models
@inject ApplicationDbContext DbContext
<h3>Katalog</h3>
<h3>Katalog Produktů</h3>
<table class="table">
<thead>
<tr>
<th>Název</th>
<th>Kategorie</th>
<th>Cena</th>
<th>Stock</th>
</tr>
</thead>
<tbody>
@foreach (var product in products)
{
<tr>
<td>@product.Name</td>
<td>@product.Category.Name</td>
<td>@product.Price.ToString("C")</td>
<td>@product.StockQuantity</td>
</tr>
}
</tbody>
</table>
@code {
private List<Product> products;
protected override async Task OnInitializedAsync()
{
products = await DbContext.Products
.Include(p => p.Category)
.ToListAsync();
}
}