katalog
This commit is contained in:
@@ -1,7 +1,40 @@
|
|||||||
@page "/"
|
@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 {
|
@code {
|
||||||
|
private List<Product> products;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
products = await DbContext.Products
|
||||||
|
.Include(p => p.Category)
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user