Update speisekarte2 details

This commit is contained in:
MET18937 2023-06-23 20:04:11 +02:00
parent a51fe08db8
commit 04a221f20b
6 changed files with 200 additions and 79 deletions

View File

@ -1,6 +1,7 @@
@page "/SpeisekarteChinesich"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Chinesisch</h1>
<div class="container">
@ -25,7 +26,7 @@
{
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3 ">
<div class="card mt-3 " @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
@ -53,30 +54,55 @@
<div class="card-header">
Warenkorb
</div>
@if (menuitemIds.Count == 0)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Nudeln mit Hühnerfleisch</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">9.10€</span></p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">Warenkorb ist leer</h5>
</div>
}
else
{
@foreach (var item in menuitemIds)
{
@foreach (var item2 in menuitems)
{
@if (item.Key == item2.IdmenuItem)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Coca Cola</h5>
@*<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>*@
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">3.10€</span></p>
<p>@item.Value</p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">@item2.Bezeichnung</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">@item2.Zusatzinformation</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">@item2.Preis</span></p>
</div>
}
}
}
}
</div>
<div class="d-flex flex-column">
<a href="#" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="#" class="btn btn-primary mx-2 mt-1">Weiter</a>
<div class="d-flex flex-column mb-5">
<a href="/speisekarte" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="/shopping_cart" class="btn btn-primary mx-2 mt-1 mb-5">Weiter</a>
</div>
</div>
</div>
</div>
@code {
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
private void SetMenuItemId(int id)
{
if (menuitemIds.ContainsKey(id))
{
menuitemIds[id]++;
}
else
{
menuitemIds.Add(id, 1);
}
localStorage.SetItem<Dictionary<int, int>>("MenuItemIds", menuitemIds);
}
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
private List<Allergie> allergien = new List<Allergie>();
@ -89,6 +115,11 @@
protected override async Task OnInitializedAsync()
{
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
}
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");
@ -96,6 +127,7 @@
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");
}
public class Allergie

View File

@ -1,6 +1,7 @@
@page "/SpeisekarteGetraenke"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Getränke</h1>
@* create an container bootstrap 5*@
@ -27,7 +28,7 @@
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3 ">
<div class="card mt-3 " @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
@ -45,12 +46,9 @@
}
}
}
}
}
}
}
</div>
<div class="col-4">
@* warenkorb anzeige als bootstrap card*@
@ -58,24 +56,35 @@
<div class="card-header">
Warenkorb
</div>
@if (menuitemIds.Count == 0)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Nudeln mit Hühnerfleisch</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">9.10€</span></p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">Warenkorb ist leer</h5>
</div>
}
else
{
@foreach (var item in menuitemIds)
{
@foreach (var item2 in menuitems)
{
@if (item.Key == item2.IdmenuItem)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Coca Cola</h5>
@*<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>*@
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">3.10€</span></p>
<p>@item.Value</p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">@item2.Bezeichnung</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">@item2.Zusatzinformation</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">@item2.Preis</span></p>
</div>
}
}
}
}
</div>
<div class="d-flex flex-column">
<a href="#" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="#" class="btn btn-primary mx-2 mt-1">Weiter</a>
<div class="d-flex flex-column mb-5">
<a href="/speisekarte" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="/shopping_cart" class="btn btn-primary mx-2 mt-1 mb-5">Weiter</a>
</div>
</div>
</div>
</div>
@ -84,6 +93,23 @@
@code {
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
private void SetMenuItemId(int id)
{
if (menuitemIds.ContainsKey(id))
{
menuitemIds[id]++;
}
else
{
menuitemIds.Add(id, 1);
}
localStorage.SetItem<Dictionary<int, int>>("MenuItemIds", menuitemIds);
}
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
private List<Allergie> allergien = new List<Allergie>();
@ -96,6 +122,11 @@
protected override async Task OnInitializedAsync()
{
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
}
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");

View File

@ -1,6 +1,7 @@
@page "/SpeisekarteSonstiges"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Sonstiges</h1>
@* create an container bootstrap 5*@
@ -18,7 +19,7 @@
@foreach (var item in menuitemueberkategories)
{
@if (item.Bezeichnung == "Japanisch")
@if (item.Bezeichnung == "Sonstiges")
{
@foreach (var item2 in menuitemkategories)
{
@ -29,7 +30,7 @@
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3 ">
<div class="card mt-3 " @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
@ -58,24 +59,35 @@
<div class="card-header">
Warenkorb
</div>
@if (menuitemIds.Count == 0)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Nudeln mit Hühnerfleisch</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">9.10€</span></p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">Warenkorb ist leer</h5>
</div>
}
else
{
@foreach (var item in menuitemIds)
{
@foreach (var item2 in menuitems)
{
@if (item.Key == item2.IdmenuItem)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Coca Cola</h5>
@*<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>*@
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">3.10€</span></p>
<p>@item.Value</p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">@item2.Bezeichnung</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">@item2.Zusatzinformation</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">@item2.Preis</span></p>
</div>
}
}
}
}
</div>
<div class="d-flex flex-column">
<a href="#" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="#" class="btn btn-primary mx-2 mt-1">Weiter</a>
<div class="d-flex flex-column mb-5">
<a href="/speisekarte" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="/shopping_cart" class="btn btn-primary mx-2 mt-1 mb-5">Weiter</a>
</div>
</div>
</div>
</div>
@ -86,6 +98,21 @@
@code {
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
private void SetMenuItemId(int id)
{
if (menuitemIds.ContainsKey(id))
{
menuitemIds[id]++;
}
else
{
menuitemIds.Add(id, 1);
}
localStorage.SetItem<Dictionary<int, int>>("MenuItemIds", menuitemIds);
}
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
private List<Allergie> allergien = new List<Allergie>();
@ -98,6 +125,10 @@
protected override async Task OnInitializedAsync()
{
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
}
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");

View File

@ -1,6 +1,7 @@
@page "/SpeisekarteJapanisch"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Japanisch</h1>
@* create an container bootstrap 5*@
@ -14,8 +15,6 @@
<button type="button" class="btn">Bento</button>
<button type="button" class="btn">Nachspeise</button>
</div>
@foreach (var item in menuitemueberkategories)
{
@if (item.Bezeichnung == "Japanisch")
@ -28,8 +27,7 @@
{
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3 ">
<div class="card mt-3" @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
@ -47,12 +45,9 @@
}
}
}
}
}
}
}
</div>
<div class="col-4">
@* warenkorb anzeige als bootstrap card*@
@ -60,24 +55,35 @@
<div class="card-header">
Warenkorb
</div>
@if (menuitemIds.Count == 0)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Nudeln mit Hühnerfleisch</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">9.10€</span></p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">Warenkorb ist leer</h5>
</div>
}
else
{
@foreach (var item in menuitemIds)
{
@foreach (var item2 in menuitems)
{
@if (item.Key == item2.IdmenuItem)
{
<div class="card-body">
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">1 Coca Cola</h5>
@*<p class="card-text" style="font-size:8pt;margin-bottom:0px;">mit Knoblauchsoße</p>*@
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">3.10€</span></p>
<p>@item.Value</p>
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">@item2.Bezeichnung</h5>
<p class="card-text" style="font-size:8pt;margin-bottom:0px;">@item2.Zusatzinformation</p>
<p class="card-text" id="preis" style="text-align:right; "><span style="background-color:#c7ffd5; border-radius:20px; font-size:10pt; padding:5px">@item2.Preis</span></p>
</div>
}
}
}
}
</div>
<div class="d-flex flex-column">
<a href="#" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="#" class="btn btn-primary mx-2 mt-1">Weiter</a>
<div class="d-flex flex-column mb-5">
<a href="/speisekarte" class="btn btn-primary mx-2 mt-5">Zurück</a>
<a href="/shopping_cart" class="btn btn-primary mx-2 mt-1 mb-5">Weiter</a>
</div>
</div>
</div>
</div>
@ -86,6 +92,21 @@
@code {
public Dictionary<int, int> menuitemIds = new Dictionary<int, int>();
private void SetMenuItemId(int id)
{
if (menuitemIds.ContainsKey(id))
{
menuitemIds[id]++;
}
else
{
menuitemIds.Add(id, 1);
}
localStorage.SetItem<Dictionary<int, int>>("MenuItemIds", menuitemIds);
}
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
private List<Allergie> allergien = new List<Allergie>();
@ -98,6 +119,10 @@
protected override async Task OnInitializedAsync()
{
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
}
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");

View File

@ -1,3 +1,4 @@
using Blazored.LocalStorage;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using y4f;
@ -6,7 +7,7 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });

View File

@ -26,6 +26,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.1" PrivateAssets="all" />
</ItemGroup>