mirror of
https://github.com/yummy4friends/y4f.git
synced 2025-01-14 16:37:08 +01:00
Add visibility if valid kunde on speisekarte
This commit is contained in:
parent
a9418aea33
commit
d45fa68fe0
@ -3,6 +3,7 @@
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<PageTitle>Yummy4Friends</PageTitle>
|
||||
|
||||
@ -35,6 +36,7 @@
|
||||
if (kunde.Code == qrcodeValue)
|
||||
{
|
||||
localStorage.SetItem("kunde", kunde);
|
||||
_navigationManager.NavigateTo("/speisekarte");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
@page "/Speisekarte"
|
||||
|
||||
@inject HttpClient Http
|
||||
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
|
||||
@inject NavigationManager _navigationManager
|
||||
|
||||
<h1>Speisekarte</h1>
|
||||
<div class="row justify-content-center">
|
||||
@ -72,11 +74,29 @@
|
||||
@code {
|
||||
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
|
||||
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
|
||||
private List<Kunde> kunden = new List<Kunde>();
|
||||
|
||||
private Kunde curretKunde = new Kunde();
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
|
||||
if (kunden.Count > 0)
|
||||
{
|
||||
var kunde = localStorage.GetItem<Kunde>("kunde");
|
||||
if (kunde != null)
|
||||
{
|
||||
curretKunde = kunde;
|
||||
}
|
||||
else
|
||||
{
|
||||
_navigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
||||
|
||||
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/MenuItemKategories");
|
||||
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/MenuItemUeberkategories");
|
||||
|
||||
}
|
||||
|
||||
public class Menuitemkategorie
|
||||
@ -97,4 +117,11 @@
|
||||
}
|
||||
|
||||
|
||||
public class Kunde
|
||||
{
|
||||
public int Idkunde { get; set; }
|
||||
public string Code { get; set; }
|
||||
public int Treuepunkte { get; set; }
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user