31 lines
824 B
C#
31 lines
824 B
C#
using CocktailWeb;
|
|
using CocktailWeb.Data;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Forms;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace CocktailWeb.Pages
|
|
{
|
|
public partial class Cocktails
|
|
{
|
|
private DbDataContext? _DataContext;
|
|
|
|
private List<Cocktail> CocktailListe { get; set; } = new();
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await ShowCocktails();
|
|
}
|
|
|
|
private async Task ShowCocktails()
|
|
{
|
|
_DataContext ??= await DataContextFactory.CreateDbContextAsync();
|
|
if (_DataContext != null)
|
|
{
|
|
CocktailListe = await _DataContext.Cocktails.OrderBy(f => f.Name).ToListAsync();
|
|
}
|
|
}
|
|
}
|
|
}
|