Compare commits

...

2 Commits

Author SHA1 Message Date
MET18937
3356a91d47 Add current kunde usage 2023-06-25 21:10:00 +02:00
MET18937
bbbefa43b4 Add page acees only on valid kunde login 2023-06-25 21:06:53 +02:00
20 changed files with 515 additions and 233 deletions

View File

@ -1,90 +1,125 @@
@page "/allergene"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}
<PageTitle>Allergene</PageTitle>
<table class="tg">
<thead>
<tr>
<th class="tg-c3ow" colspan="3">Allergeninformation<br>gemäß Codex-Empfehlung </th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-0pky">Visuelles</td>
<td class="tg-0pky">Kurzbezeichnung</td>
<td class="tg-0pky">Buchstabencode</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/getreide.png" alt="Getreide"></td>
<td class="tg-0pky">glutenhaltiges Getreide</td>
<td class="tg-c3ow">A</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/krebstiere.png" alt="Krebstiere"></td>
<td class="tg-0pky">Krebstiere</td>
<td class="tg-c3ow">B</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/ei.png" alt="Ei"></td>
<td class="tg-0pky">Ei</td>
<td class="tg-c3ow">C</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/fisch.png" alt="Fisch"></td>
<td class="tg-0pky">Fisch</td>
<td class="tg-c3ow">D</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/erdnuss.png" alt="Erdnuss"></td>
<td class="tg-0pky">Erdnuss</td>
<td class="tg-c3ow">E</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/soja.png" alt="Soja"></td>
<td class="tg-0pky">Soja</td>
<td class="tg-c3ow">F</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/milch.png" alt="Milch oder Laktose"></td>
<td class="tg-0pky">Milch oder Laktose</td>
<td class="tg-c3ow">G</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/schalenfruechte.png" alt="Schalenfrüchte"></td>
<td class="tg-0pky">Schalenfrüchte</td>
<td class="tg-c3ow">H</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/sellerie.png" alt="Sellerie"></td>
<td class="tg-0pky">Sellerie</td>
<td class="tg-c3ow">L</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/senf.png" alt="Senf"></td>
<td class="tg-0pky">Senf</td>
<td class="tg-c3ow">M</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/sesam.png" alt="Sesam"></td>
<td class="tg-0pky">Sesam</td>
<td class="tg-c3ow">N</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/sulfite.png" alt="Sulfite"></td>
<td class="tg-0pky">Sulfite</td>
<td class="tg-c3ow">O</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/lupinen.png" alt="Lupinen"></td>
<td class="tg-0pky">Lupinen</td>
<td class="tg-c3ow">P</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/weichtiere.png" alt="Weichtiere"></td>
<td class="tg-0pky">Weichtiere</td>
<td class="tg-c3ow">R</td>
</tr>
</tbody>
<thead>
<tr>
<th class="tg-c3ow" colspan="3">Allergeninformation<br>gemäß Codex-Empfehlung </th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-0pky">Visuelles</td>
<td class="tg-0pky">Kurzbezeichnung</td>
<td class="tg-0pky">Buchstabencode</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/getreide.png" alt="Getreide"></td>
<td class="tg-0pky">glutenhaltiges Getreide</td>
<td class="tg-c3ow">A</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/krebstiere.png" alt="Krebstiere"></td>
<td class="tg-0pky">Krebstiere</td>
<td class="tg-c3ow">B</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/ei.png" alt="Ei"></td>
<td class="tg-0pky">Ei</td>
<td class="tg-c3ow">C</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/fisch.png" alt="Fisch"></td>
<td class="tg-0pky">Fisch</td>
<td class="tg-c3ow">D</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/erdnuss.png" alt="Erdnuss"></td>
<td class="tg-0pky">Erdnuss</td>
<td class="tg-c3ow">E</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/soja.png" alt="Soja"></td>
<td class="tg-0pky">Soja</td>
<td class="tg-c3ow">F</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/milch.png" alt="Milch oder Laktose"></td>
<td class="tg-0pky">Milch oder Laktose</td>
<td class="tg-c3ow">G</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/schalenfruechte.png" alt="Schalenfrüchte"></td>
<td class="tg-0pky">Schalenfrüchte</td>
<td class="tg-c3ow">H</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/sellerie.png" alt="Sellerie"></td>
<td class="tg-0pky">Sellerie</td>
<td class="tg-c3ow">L</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/senf.png" alt="Senf"></td>
<td class="tg-0pky">Senf</td>
<td class="tg-c3ow">M</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/sesam.png" alt="Sesam"></td>
<td class="tg-0pky">Sesam</td>
<td class="tg-c3ow">N</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/sulfite.png" alt="Sulfite"></td>
<td class="tg-0pky">Sulfite</td>
<td class="tg-c3ow">O</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/lupinen.png" alt="Lupinen"></td>
<td class="tg-0pky">Lupinen</td>
<td class="tg-c3ow">P</td>
</tr>
<tr>
<td class="tg-0pky"><img class="icon" src="assets/weichtiere.png" alt="Weichtiere"></td>
<td class="tg-0pky">Weichtiere</td>
<td class="tg-c3ow">R</td>
</tr>
</tbody>
</table>
<br><br><br><br>
<br>
<br>
<br>
<br>

View File

@ -1,5 +1,33 @@
@page "/cookies"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}
<!DOCTYPE html>
<html lang="">
<head>

View File

@ -1,5 +1,33 @@
@page "/datenschutzerklärung"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}
<!DOCTYPE html>
<html lang="">
<head>

View File

@ -1,57 +0,0 @@
@page "/fetchdata"
@inject HttpClient Http
<PageTitle>Weather forecast</PageTitle>
<h1>Weather forecast</h1>
<p>This component demonstrates fetching data from the server.</p>
@if (forecasts == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Date</th>
<th>Temp. (C)</th>
<th>Temp. (F)</th>
<th>Summary</th>
</tr>
</thead>
<tbody>
@foreach (var forecast in forecasts)
{
<tr>
<td>@forecast.Date.ToShortDateString()</td>
<td>@forecast.TemperatureC</td>
<td>@forecast.TemperatureF</td>
<td>@forecast.Summary</td>
</tr>
}
</tbody>
</table>
}
@code {
private WeatherForecast[]? forecasts;
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public string? Summary { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
}
}

View File

@ -1,20 +1,56 @@
 @page "/"
@layout Startseite
@page "/"
@layout Startseite
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<PageTitle>Yummy4Friends</PageTitle>
<body style='--blazor-load-percentage: 100%; --blazor-load-percentage-text: "100%"; background-color:#C7FFD5;'>
<div class="container col-lg-6 col-md-9 col-sm-12 d-flex flex-column " id="content">
<center><h1>Herzlich Willkommen!</h1></center>
<img src="assets/Logo_new.png" class="img" title="logo image">
<div class="container col-lg-6 col-md-9 col-sm-12 d-flex flex-column " id="content" style=" padding-left:10%; padding-right:10%;">
<center><h1>Herzlich Willkommen!</h1></center>
<form action="Speisekarte">
<input type="submit" value="Zur Speisekarte" class="btn" />
</form>
</div>
<img src="assets/Logo_new.png" class="img" title="logo image">
<input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode" @bind-value="@qrcodeValue">
<button type="submit" id="button1" class="btn" @onclick="@(() => CheckCode())">Bestätigen</button>
</div>
</body>
@code {
private string qrcodeValue;
private List<Kunde> kunden = new List<Kunde>();
public void CheckCode()
{
foreach (var kunde in kunden)
{
if (kunde.Code == qrcodeValue)
{
localStorage.SetItem("kunde", kunde);
_navigationManager.NavigateTo("/speisekarte");
break;
}
}
}
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}

View File

@ -1,5 +1,37 @@
@page "/Kontakt"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}
<h3>Kontakt</h3>
<h4>Kundenservice</h4>

View File

@ -122,6 +122,9 @@
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public int hour;
public int minute;
private void UpdateTime()
@ -182,7 +185,6 @@
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -190,6 +192,17 @@
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// get data from localstorage
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
@ -199,7 +212,6 @@
// get data from api
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");

View File

@ -1,6 +1,9 @@
@page "/Speisekarte"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte</h1>
<div class="row justify-content-center">
@ -70,11 +73,24 @@
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/MenuItemKategories");
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/MenuItemUeberkategories");
}
@ -97,4 +113,10 @@
}
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}

View File

@ -2,6 +2,7 @@
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Chinesisch</h1>
<div class="container">
@ -89,6 +90,9 @@
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
private void SetMenuItemId(int id)
@ -107,7 +111,6 @@
private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -115,6 +118,18 @@
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -2,6 +2,7 @@
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Getränke</h1>
@* create an container bootstrap 5*@
@ -93,6 +94,8 @@
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
@ -114,7 +117,6 @@
private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -122,6 +124,18 @@
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -2,6 +2,7 @@
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Sonstiges</h1>
@* create an container bootstrap 5*@
@ -98,6 +99,8 @@
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
@ -117,7 +120,6 @@
private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -125,6 +127,17 @@
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -2,6 +2,7 @@
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Japanisch</h1>
@* create an container bootstrap 5*@
@ -92,6 +93,8 @@
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
@ -111,7 +114,6 @@
private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -119,6 +121,18 @@
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -1,51 +0,0 @@
@page "/TestFetchAllergienData"
@inject HttpClient Http
<PageTitle>Allergien</PageTitle>
<h1>Allergien</h1>
<p>This component demonstrates fetching data from the mysql server.</p>
@if (allergien == null)
{
<p><em>Loading...</em></p>
}
else
{
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Beschreibung</th>
</tr>
</thead>
<tbody>
@foreach (var allergie in allergien)
{
<tr>
<td>@allergie.Idallergie</td>
<td>@allergie.Beschreibung</td>
</tr>
}
</tbody>
</table>
}
@code {
private const string ServiceEndpoint = "https://localhost:7076/api/Allergien";
private Allergie[]? allergien;
protected override async Task OnInitializedAsync()
{
allergien = await Http.GetFromJsonAsync<Allergie[]>(ServiceEndpoint);
}
public partial class Allergie
{
public int Idallergie { get; set; }
public string? Beschreibung { get; set; }
}
}

View File

@ -1,5 +1,37 @@
@page "/yummypoints"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
}
public class Kunde
{
int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}
<body style='--blazor-load-percentage: 100%; --blazor-load-percentage-text: "100%";'>
<div class="d-flex justify-content-center">

View File

@ -158,18 +158,29 @@
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
// get data from api
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
menuitems = await Http.GetFromJsonAsync<List<Menuitem>>("https://localhost:7076/api/Menuitems");
menuitemkategories = await Http.GetFromJsonAsync<List<Menuitemkategorie>>("https://localhost:7076/api/Menuitemkategories");
menuitemueberkategories = await Http.GetFromJsonAsync<List<Menuitemueberkategorie>>("https://localhost:7076/api/Menuitemueberkategories");
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
// test use the first kunde
kunde = kunden[1];
// get kunde from local storage
kunde = localStorage.GetItem<Kunde>("kunde");
// get the most recent rabatt, that are still valid (GueltigkeitBis)
// if there is no rabatt, set the rabatt to null

View File

@ -75,6 +75,18 @@
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
// get data from api
allergien = await Http.GetFromJsonAsync<List<Allergie>>("https://localhost:7076/api/allergien");
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
@ -85,7 +97,8 @@
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
// test use the first kunde
kunde = kunden[1];
// get kunde from local storage
kunde = localStorage.GetItem<Kunde>("kunde");
// get the most recent rabatt, that are still valid (GueltigkeitBis)
// if there is no rabatt, set the rabatt to null

View File

@ -1,5 +1,36 @@
@page "/FBestätigung"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
}
public class Kunde
{
int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
<h4>Vielen Dank für Ihr Feedback. Durch Feedbacks können wir uns stets verbessern.<br></h4>
@ -7,9 +38,3 @@
<input type="submit" value="Zur Startseite" class="btn">
</form>
</div>
@code {
}

View File

@ -1,5 +1,37 @@
@page "/Feedback"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
}
public class Kunde
{
int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
}
<body>
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
<h4 for="feedback">Ihr Feedback: </h4>
@ -14,8 +46,4 @@
</div>
</body>
@code {
}
</body>

View File

@ -8,6 +8,10 @@
<br>
@*log out Button *@
<div class="container mt-auto">
<button class="btn" type="button" onclick="@Logout" id="button1">@button1</button>
</div>
<div class="container mt-auto">
<h4>AccountID: @kunde.Code</h4>
@ -125,8 +129,10 @@
@code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
bool changeButtonBool { get; set; } = true;
string button1 => changeButtonBool ? "Konto deaktivieren" : "Konto aktivieren";
@ -137,6 +143,12 @@
changeButtonBool = !changeButtonBool;
}
public void Logout()
{
localStorage.Clear();
_navigationManager.NavigateTo("/");
}
public int hour;
public int minute;
public int day;
@ -153,14 +165,24 @@
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
private List<Menuitem> menuitems = new List<Menuitem>();
private List<Rabatt> rabatte = new List<Rabatt>();
private List<BestellungspositionHasMenuitem> bestellungspositionHasMenuitems = new List<BestellungspositionHasMenuitem>();
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
// get data from api
bestellungspositions = await Http.GetFromJsonAsync<List<Bestellungsposition>>("https://localhost:7076/api/bestellungspositionen");
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
@ -168,12 +190,8 @@
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
bestellungspositionHasMenuitems = await Http.GetFromJsonAsync<List<BestellungspositionHasMenuitem>>("https://localhost:7076/api/BestellungspositionHasMenuitems");
// use kudnde with id 2
kunde = kunden[1];
// get kunde from local storage
kunde = localStorage.GetItem<Kunde>("kunde");
// get all menuitemIds from bestellungspositions with the last date
foreach (Bestellungsposition bestellungsposition in bestellungspositions)

View File

@ -1,6 +1,7 @@
@page "/Yummy-Punkte"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<body>
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
@ -59,10 +60,23 @@
protected override async Task OnInitializedAsync()
{
// kunde login start
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
if (localStorage.ContainKey("kunde"))
kunde = localStorage.GetItem<Kunde>("kunde");
else
_navigationManager.NavigateTo("/");
if (kunde != null && !kunden.Any(k => k.Code == kunde.Code))
_navigationManager.NavigateTo("/");
// kunde login end
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
kunde = kunden[1];
// get kunde from local storage
kunde = localStorage.GetItem<Kunde>("kunde");
// get the most recent rabatt, that are still valid (GueltigkeitBis)
// if there is no rabatt, set the rabatt to null