Compare commits
2 Commits
03b026f1f3
...
b7be9a7689
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7be9a7689 | ||
|
|
ab3b420953 |
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user