Compare commits

..

No commits in common. "3356a91d47d9ba0f3fa221db48c1655903ec0f83" and "8abba97ab88deee6327c2f251ce78b6f5df7550c" have entirely different histories.

20 changed files with 233 additions and 515 deletions

View File

@ -1,36 +1,5 @@
@page "/allergene" @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> <PageTitle>Allergene</PageTitle>
<table class="tg"> <table class="tg">
@ -118,8 +87,4 @@
</tbody> </tbody>
</table> </table>
<br> <br><br><br><br>
<br>
<br>
<br>

View File

@ -1,33 +1,5 @@
@page "/cookies" @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> <!DOCTYPE html>
<html lang=""> <html lang="">
<head> <head>

View File

@ -1,33 +1,5 @@
@page "/datenschutzerklärung" @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> <!DOCTYPE html>
<html lang=""> <html lang="">
<head> <head>

View File

@ -0,0 +1,57 @@
@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,56 +1,20 @@
 @page "/"  @page "/"
@layout Startseite @layout Startseite
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<PageTitle>Yummy4Friends</PageTitle> <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" style=" padding-left:10%; padding-right:10%;"> <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> <center><h1>Herzlich Willkommen!</h1></center>
<img src="assets/Logo_new.png" class="img" title="logo image"> <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"> <form action="Speisekarte">
<input type="submit" value="Zur Speisekarte" class="btn" />
<button type="submit" id="button1" class="btn" @onclick="@(() => CheckCode())">Bestätigen</button> </form>
</div> </div>
</body> </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,37 +1,5 @@
@page "/Kontakt" @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> <h3>Kontakt</h3>
<h4>Kundenservice</h4> <h4>Kundenservice</h4>

View File

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

View File

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

View File

@ -2,7 +2,6 @@
@inject HttpClient Http @inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage @inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Chinesisch</h1> <h1>Speisekarte Chinesisch</h1>
<div class="container"> <div class="container">
@ -90,9 +89,6 @@
@code { @code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>(); public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
private void SetMenuItemId(int id) private void SetMenuItemId(int id)
@ -111,6 +107,7 @@
private List<Allergie> allergien = new List<Allergie>(); private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>(); private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>(); private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>(); private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>(); private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -118,18 +115,6 @@
protected override async Task OnInitializedAsync() 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) if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{ {
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds"); menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -2,7 +2,6 @@
@inject HttpClient Http @inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage @inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Getränke</h1> <h1>Speisekarte Getränke</h1>
@* create an container bootstrap 5*@ @* create an container bootstrap 5*@
@ -94,8 +93,6 @@
@code { @code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>(); public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
@ -117,6 +114,7 @@
private List<Allergie> allergien = new List<Allergie>(); private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>(); private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>(); private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>(); private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>(); private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -124,18 +122,6 @@
protected override async Task OnInitializedAsync() 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) if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{ {
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds"); menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -2,7 +2,6 @@
@inject HttpClient Http @inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage @inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Sonstiges</h1> <h1>Speisekarte Sonstiges</h1>
@* create an container bootstrap 5*@ @* create an container bootstrap 5*@
@ -99,8 +98,6 @@
@code { @code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>(); public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
@ -120,6 +117,7 @@
private List<Allergie> allergien = new List<Allergie>(); private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>(); private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>(); private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>(); private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>(); private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -127,17 +125,6 @@
protected override async Task OnInitializedAsync() 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) if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{ {
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds"); menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -2,7 +2,6 @@
@inject HttpClient Http @inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage @inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte Japanisch</h1> <h1>Speisekarte Japanisch</h1>
@* create an container bootstrap 5*@ @* create an container bootstrap 5*@
@ -93,8 +92,6 @@
@code { @code {
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>(); public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
@ -114,6 +111,7 @@
private List<Allergie> allergien = new List<Allergie>(); private List<Allergie> allergien = new List<Allergie>();
private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>(); private List<Bestellungsposition> bestellungspositions = new List<Bestellungsposition>();
private List<Kunde> kunden = new List<Kunde>();
private List<Menuitem> menuitems = new List<Menuitem>(); private List<Menuitem> menuitems = new List<Menuitem>();
private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>(); private List<Menuitemkategorie> menuitemkategories = new List<Menuitemkategorie>();
private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>(); private List<Menuitemueberkategorie> menuitemueberkategories = new List<Menuitemueberkategorie>();
@ -121,18 +119,6 @@
protected override async Task OnInitializedAsync() 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) if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{ {
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds"); menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");

View File

@ -0,0 +1,51 @@
@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,37 +1,5 @@
@page "/yummypoints" @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%";'> <body style='--blazor-load-percentage: 100%; --blazor-load-percentage-text: "100%";'>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">

View File

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

View File

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

View File

@ -1,36 +1,5 @@
@page "/FBestätigung" @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"> <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> <h4>Vielen Dank für Ihr Feedback. Durch Feedbacks können wir uns stets verbessern.<br></h4>
@ -38,3 +7,9 @@
<input type="submit" value="Zur Startseite" class="btn"> <input type="submit" value="Zur Startseite" class="btn">
</form> </form>
</div> </div>
@code {
}

View File

@ -1,37 +1,5 @@
@page "/Feedback" @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> <body>
<div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content"> <div class="container col-lg-5 col-md-9 col-sm-12 d-flex flex-column " id="content">
<h4 for="feedback">Ihr Feedback: </h4> <h4 for="feedback">Ihr Feedback: </h4>
@ -47,3 +15,7 @@
</div> </div>
</body> </body>
@code {
}

View File

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

View File

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