Compare commits

..

No commits in common. "7cd20602b6a519d1e61783c076288e5244d1f79c" and "ba6266579dd020d71951b0826051cd14dd254832" have entirely different histories.

25 changed files with 480 additions and 2190 deletions

3
.gitignore vendored
View File

@ -2,7 +2,6 @@
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
# User-specific files # User-specific files
.vscode
.vs .vs
*/.vs */.vs
*.suo *.suo
@ -137,5 +136,3 @@ $RECYCLE.BIN/
.DS_Store .DS_Store
_NCrunch* _NCrunch*
/src/WebApi/appsettings.json
/src/WebApi/appsettings.json

View File

@ -1,138 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using WebApi.Data;
using WebApi.Models;
namespace WebApi.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class MenuitemHasAllergiesController : ControllerBase
{
private readonly WebApiContext _context;
public MenuitemHasAllergiesController(WebApiContext context)
{
_context = context;
}
// GET: api/MenuitemHasAllergies
[HttpGet]
public async Task<ActionResult<IEnumerable<MenuitemHasAllergie>>> GetMenuitemHasAllergie()
{
if (_context.MenuitemHasAllergie == null)
{
return NotFound();
}
return await _context.MenuitemHasAllergie.ToListAsync();
}
// GET: api/MenuitemHasAllergies/5
[HttpGet("{id}")]
public async Task<ActionResult<MenuitemHasAllergie>> GetMenuitemHasAllergie(int? id)
{
if (_context.MenuitemHasAllergie == null)
{
return NotFound();
}
var menuitemHasAllergie = await _context.MenuitemHasAllergie.FindAsync(id);
if (menuitemHasAllergie == null)
{
return NotFound();
}
return menuitemHasAllergie;
}
// PUT: api/MenuitemHasAllergies/5
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPut("{id}")]
public async Task<IActionResult> PutMenuitemHasAllergie(int? id, MenuitemHasAllergie menuitemHasAllergie)
{
if (id != menuitemHasAllergie.MenuItem_IDMenuItem)
{
return BadRequest();
}
_context.Entry(menuitemHasAllergie).State = EntityState.Modified;
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateConcurrencyException)
{
if (!MenuitemHasAllergieExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return NoContent();
}
// POST: api/MenuitemHasAllergies
// To protect from overposting attacks, see https://go.microsoft.com/fwlink/?linkid=2123754
[HttpPost]
public async Task<ActionResult<MenuitemHasAllergie>> PostMenuitemHasAllergie(MenuitemHasAllergie menuitemHasAllergie)
{
if (_context.MenuitemHasAllergie == null)
{
return Problem("Entity set 'WebApiContext.MenuitemHasAllergie' is null.");
}
_context.MenuitemHasAllergie.Add(menuitemHasAllergie);
try
{
await _context.SaveChangesAsync();
}
catch (DbUpdateException)
{
if (MenuitemHasAllergieExists(menuitemHasAllergie.MenuItem_IDMenuItem))
{
return Conflict();
}
else
{
throw;
}
}
return CreatedAtAction("GetMenuitemHasAllergie", new { id = menuitemHasAllergie.MenuItem_IDMenuItem }, menuitemHasAllergie);
}
// DELETE: api/MenuitemHasAllergies/5
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteMenuitemHasAllergie(int? id)
{
if (_context.MenuitemHasAllergie == null)
{
return NotFound();
}
var menuitemHasAllergie = await _context.MenuitemHasAllergie.FindAsync(id);
if (menuitemHasAllergie == null)
{
return NotFound();
}
_context.MenuitemHasAllergie.Remove(menuitemHasAllergie);
await _context.SaveChangesAsync();
return NoContent();
}
private bool MenuitemHasAllergieExists(int? id)
{
return (_context.MenuitemHasAllergie?.Any(e => e.MenuItem_IDMenuItem == id)).GetValueOrDefault();
}
}
}

View File

@ -7,237 +7,231 @@ namespace WebApi.Data;
public partial class WebApiContext : DbContext public partial class WebApiContext : DbContext
{ {
public WebApiContext(DbContextOptions<WebApiContext> options) public WebApiContext(DbContextOptions<WebApiContext> options)
: base(options) : base(options)
{ {
} }
public virtual DbSet<Allergie> Allergies { get; set; } public virtual DbSet<Allergie> Allergies { get; set; }
public virtual DbSet<Bestellungsposition> Bestellungspositions { get; set; } public virtual DbSet<Bestellungsposition> Bestellungspositions { get; set; }
public virtual DbSet<Kunde> Kundes { get; set; } public virtual DbSet<Kunde> Kundes { get; set; }
public virtual DbSet<Menuitem> Menuitems { get; set; } public virtual DbSet<Menuitem> Menuitems { get; set; }
public virtual DbSet<Menuitemkategorie> Menuitemkategories { get; set; } public virtual DbSet<Menuitemkategorie> Menuitemkategories { get; set; }
public virtual DbSet<Menuitemueberkategorie> Menuitemueberkategories { get; set; } public virtual DbSet<Menuitemueberkategorie> Menuitemueberkategories { get; set; }
public virtual DbSet<Rabatt> Rabatts { get; set; } public virtual DbSet<Rabatt> Rabatts { get; set; }
public virtual DbSet<MenuitemHasAllergie> MenuitemHasAllergie { get; set; } public virtual DbSet<Admin> Admins{ get; set; }
public virtual DbSet<Admin> Admins { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
modelBuilder modelBuilder
.UseCollation("utf8_general_ci") .UseCollation("utf8_general_ci")
.HasCharSet("utf8"); .HasCharSet("utf8");
modelBuilder.Entity<Allergie>(entity => modelBuilder.Entity<Allergie>(entity =>
{ {
entity.HasKey(e => e.Idallergie).HasName("PRIMARY"); entity.HasKey(e => e.Idallergie).HasName("PRIMARY");
entity.ToTable("allergie"); entity.ToTable("allergie");
entity.Property(e => e.Idallergie) entity.Property(e => e.Idallergie)
.ValueGeneratedNever() .ValueGeneratedNever()
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("IDAllergie"); .HasColumnName("IDAllergie");
entity.Property(e => e.Beschreibung).HasMaxLength(45); entity.Property(e => e.Beschreibung).HasMaxLength(45);
}); });
modelBuilder.Entity<Bestellungsposition>(entity => modelBuilder.Entity<Bestellungsposition>(entity =>
{ {
entity.HasKey(e => e.Idbestellung).HasName("PRIMARY"); entity.HasKey(e => e.Idbestellung).HasName("PRIMARY");
entity.ToTable("bestellungsposition"); entity.ToTable("bestellungsposition");
entity.HasIndex(e => e.KundeIdkunde, "fk_Bestellung_Kunde"); entity.HasIndex(e => e.KundeIdkunde, "fk_Bestellung_Kunde");
entity.HasIndex(e => e.RabattIdrabatt, "fk_Bestellungsposition_Rabatt1"); entity.HasIndex(e => e.RabattIdrabatt, "fk_Bestellungsposition_Rabatt1");
entity.Property(e => e.Idbestellung) entity.Property(e => e.Idbestellung)
.ValueGeneratedNever() .ValueGeneratedNever()
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("IDBestellung"); .HasColumnName("IDBestellung");
entity.Property(e => e.Datum).HasColumnType("datetime"); entity.Property(e => e.Datum).HasColumnType("datetime");
entity.Property(e => e.KundeIdkunde) entity.Property(e => e.KundeIdkunde)
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("Kunde_IDKunde"); .HasColumnName("Kunde_IDKunde");
entity.Property(e => e.Menge).HasColumnType("int(11)"); entity.Property(e => e.Menge).HasColumnType("int(11)");
entity.Property(e => e.RabattIdrabatt) entity.Property(e => e.RabattIdrabatt)
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("Rabatt_IDRabatt"); .HasColumnName("Rabatt_IDRabatt");
entity.HasOne(d => d.KundeIdkundeNavigation).WithMany(p => p.Bestellungspositions) entity.HasOne(d => d.KundeIdkundeNavigation).WithMany(p => p.Bestellungspositions)
.HasForeignKey(d => d.KundeIdkunde) .HasForeignKey(d => d.KundeIdkunde)
.OnDelete(DeleteBehavior.ClientSetNull) .OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_Bestellung_Kunde"); .HasConstraintName("fk_Bestellung_Kunde");
entity.HasOne(d => d.RabattIdrabattNavigation).WithMany(p => p.Bestellungspositions) entity.HasOne(d => d.RabattIdrabattNavigation).WithMany(p => p.Bestellungspositions)
.HasForeignKey(d => d.RabattIdrabatt) .HasForeignKey(d => d.RabattIdrabatt)
.OnDelete(DeleteBehavior.ClientSetNull) .OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_Bestellungsposition_Rabatt1"); .HasConstraintName("fk_Bestellungsposition_Rabatt1");
entity.HasMany(d => d.MenuItemIdmenuItems).WithMany(p => p.BestellungspositionIdbestellungs) entity.HasMany(d => d.MenuItemIdmenuItems).WithMany(p => p.BestellungspositionIdbestellungs)
.UsingEntity<Dictionary<string, object>>( .UsingEntity<Dictionary<string, object>>(
"BestellungspositionHasMenuitem", "BestellungspositionHasMenuitem",
r => r.HasOne<Menuitem>().WithMany() r => r.HasOne<Menuitem>().WithMany()
.HasForeignKey("MenuItemIdmenuItem") .HasForeignKey("MenuItemIdmenuItem")
.OnDelete(DeleteBehavior.ClientSetNull) .OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_MenuItem1"), .HasConstraintName("fk_Bestellungsposition_has_MenuItem_MenuItem1"),
l => l.HasOne<Bestellungsposition>().WithMany() l => l.HasOne<Bestellungsposition>().WithMany()
.HasForeignKey("BestellungspositionIdbestellung") .HasForeignKey("BestellungspositionIdbestellung")
.OnDelete(DeleteBehavior.ClientSetNull) .OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_Bestellungsposition1"), .HasConstraintName("fk_Bestellungsposition_has_MenuItem_Bestellungsposition1"),
j => j =>
{ {
j.HasKey("BestellungspositionIdbestellung", "MenuItemIdmenuItem") j.HasKey("BestellungspositionIdbestellung", "MenuItemIdmenuItem")
.HasName("PRIMARY") .HasName("PRIMARY")
.HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 }); .HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
j.ToTable("bestellungsposition_has_menuitem"); j.ToTable("bestellungsposition_has_menuitem");
j.HasIndex(new[] { "MenuItemIdmenuItem" }, "fk_Bestellungsposition_has_MenuItem_MenuItem1"); j.HasIndex(new[] { "MenuItemIdmenuItem" }, "fk_Bestellungsposition_has_MenuItem_MenuItem1");
j.IndexerProperty<int>("BestellungspositionIdbestellung") j.IndexerProperty<int>("BestellungspositionIdbestellung")
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("Bestellungsposition_IDBestellung"); .HasColumnName("Bestellungsposition_IDBestellung");
j.IndexerProperty<int>("MenuItemIdmenuItem") j.IndexerProperty<int>("MenuItemIdmenuItem")
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("MenuItem_IDMenuItem"); .HasColumnName("MenuItem_IDMenuItem");
}); });
}); });
modelBuilder.Entity<Kunde>(entity => modelBuilder.Entity<Kunde>(entity =>
{ {
entity.HasKey(e => e.Idkunde).HasName("PRIMARY"); entity.HasKey(e => e.Idkunde).HasName("PRIMARY");
entity.ToTable("kunde"); entity.ToTable("kunde");
entity.Property(e => e.Idkunde) entity.Property(e => e.Idkunde)
.ValueGeneratedNever() .ValueGeneratedNever()
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("IDKunde"); .HasColumnName("IDKunde");
entity.Property(e => e.Code) entity.Property(e => e.Code)
.HasMaxLength(45) .HasMaxLength(45)
.HasColumnName("code"); .HasColumnName("code");
entity.Property(e => e.Treuepunkte).HasColumnType("int(11)"); entity.Property(e => e.Treuepunkte).HasColumnType("int(11)");
}); });
modelBuilder.Entity<Menuitem>(entity => modelBuilder.Entity<Menuitem>(entity =>
{ {
entity.HasKey(e => e.IdmenuItem).HasName("PRIMARY"); entity.HasKey(e => e.IdmenuItem).HasName("PRIMARY");
entity.ToTable("menuitem"); entity.ToTable("menuitem");
entity.HasIndex(e => e.MenuItemKategorieIdmenuItemKategorie, "fk_MenuItem_MenuItemKategorie1"); entity.HasIndex(e => e.MenuItemKategorieIdmenuItemKategorie, "fk_MenuItem_MenuItemKategorie1");
entity.Property(e => e.IdmenuItem) entity.Property(e => e.IdmenuItem)
.ValueGeneratedNever() .ValueGeneratedNever()
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("IDMenuItem"); .HasColumnName("IDMenuItem");
entity.Property(e => e.Bezeichnung).HasMaxLength(45); entity.Property(e => e.Bezeichnung).HasMaxLength(45);
entity.Property(e => e.MenuItemKategorieIdmenuItemKategorie) entity.Property(e => e.MenuItemKategorieIdmenuItemKategorie)
.HasColumnType("int(11)") .HasColumnType("int(11)")
.HasColumnName("MenuItemKategorie_IDMenuItemKategorie"); .HasColumnName("MenuItemKategorie_IDMenuItemKategorie");
entity.Property(e => e.Preis).HasPrecision(8, 2); entity.Property(e => e.Preis).HasPrecision(8, 2);
entity.Property(e => e.Zusatzinformation).HasMaxLength(45); entity.Property(e => e.Zusatzinformation).HasMaxLength(45);
entity.HasOne(d => d.MenuItemKategorieIdmenuItemKategorieNavigation).WithMany(p => p.Menuitems) entity.HasOne(d => d.MenuItemKategorieIdmenuItemKategorieNavigation).WithMany(p => p.Menuitems)
.HasForeignKey(d => d.MenuItemKategorieIdmenuItemKategorie) .HasForeignKey(d => d.MenuItemKategorieIdmenuItemKategorie)
.OnDelete(DeleteBehavior.ClientSetNull) .OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_MenuItem_MenuItemKategorie1"); .HasConstraintName("fk_MenuItem_MenuItemKategorie1");
});
modelBuilder.Entity<Menuitemkategorie>(entity => entity.HasMany(d => d.AllergieIdallergies).WithMany(p => p.MenuItemIdmenuItems)
{ .UsingEntity<Dictionary<string, object>>(
entity.HasKey(e => e.IdmenuItemKategorie).HasName("PRIMARY"); "MenuitemHasAllergie",
r => r.HasOne<Allergie>().WithMany()
.HasForeignKey("AllergieIdallergie")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_MenuItem_has_Allergie_Allergie1"),
l => l.HasOne<Menuitem>().WithMany()
.HasForeignKey("MenuItemIdmenuItem")
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_MenuItem_has_Allergie_MenuItem1"),
j =>
{
j.HasKey("MenuItemIdmenuItem", "AllergieIdallergie")
.HasName("PRIMARY")
.HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
j.ToTable("menuitem_has_allergie");
j.HasIndex(new[] { "AllergieIdallergie" }, "fk_MenuItem_has_Allergie_Allergie1");
j.IndexerProperty<int>("MenuItemIdmenuItem")
.HasColumnType("int(11)")
.HasColumnName("MenuItem_IDMenuItem");
j.IndexerProperty<int>("AllergieIdallergie")
.HasColumnType("int(11)")
.HasColumnName("Allergie_IDAllergie");
});
});
entity.ToTable("menuitemkategorie"); modelBuilder.Entity<Menuitemkategorie>(entity =>
{
entity.HasKey(e => e.IdmenuItemKategorie).HasName("PRIMARY");
entity.HasIndex(e => e.MenuItemUeberkategorieIdmenuItemUeberkategorie, "fk_MenuItemKategorie_MenuItemUeberkategorie1"); entity.ToTable("menuitemkategorie");
entity.Property(e => e.IdmenuItemKategorie) entity.HasIndex(e => e.MenuItemUeberkategorieIdmenuItemUeberkategorie, "fk_MenuItemKategorie_MenuItemUeberkategorie1");
.ValueGeneratedNever()
.HasColumnType("int(11)")
.HasColumnName("IDMenuItemKategorie");
entity.Property(e => e.Bezeichnung).HasMaxLength(45);
entity.Property(e => e.MenuItemUeberkategorieIdmenuItemUeberkategorie)
.HasColumnType("int(11)")
.HasColumnName("MenuItemUeberkategorie_IDMenuItemUeberkategorie");
entity.HasOne(d => d.MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation).WithMany(p => p.Menuitemkategories) entity.Property(e => e.IdmenuItemKategorie)
.HasForeignKey(d => d.MenuItemUeberkategorieIdmenuItemUeberkategorie) .ValueGeneratedNever()
.OnDelete(DeleteBehavior.ClientSetNull) .HasColumnType("int(11)")
.HasConstraintName("fk_MenuItemKategorie_MenuItemUeberkategorie1"); .HasColumnName("IDMenuItemKategorie");
}); entity.Property(e => e.Bezeichnung).HasMaxLength(45);
entity.Property(e => e.MenuItemUeberkategorieIdmenuItemUeberkategorie)
.HasColumnType("int(11)")
.HasColumnName("MenuItemUeberkategorie_IDMenuItemUeberkategorie");
modelBuilder.Entity<Menuitemueberkategorie>(entity => entity.HasOne(d => d.MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation).WithMany(p => p.Menuitemkategories)
{ .HasForeignKey(d => d.MenuItemUeberkategorieIdmenuItemUeberkategorie)
entity.HasKey(e => e.IdmenuItemUeberkategorie).HasName("PRIMARY"); .OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_MenuItemKategorie_MenuItemUeberkategorie1");
});
entity.ToTable("menuitemueberkategorie"); modelBuilder.Entity<Menuitemueberkategorie>(entity =>
{
entity.HasKey(e => e.IdmenuItemUeberkategorie).HasName("PRIMARY");
entity.Property(e => e.IdmenuItemUeberkategorie) entity.ToTable("menuitemueberkategorie");
.ValueGeneratedNever()
.HasColumnType("int(11)")
.HasColumnName("IDMenuItemUeberkategorie");
entity.Property(e => e.Bezeichnung).HasMaxLength(45);
});
modelBuilder.Entity<Rabatt>(entity => entity.Property(e => e.IdmenuItemUeberkategorie)
{ .ValueGeneratedNever()
entity.HasKey(e => e.Idrabatt).HasName("PRIMARY"); .HasColumnType("int(11)")
.HasColumnName("IDMenuItemUeberkategorie");
entity.Property(e => e.Bezeichnung).HasMaxLength(45);
});
entity.ToTable("rabatt"); modelBuilder.Entity<Rabatt>(entity =>
{
entity.HasKey(e => e.Idrabatt).HasName("PRIMARY");
entity.Property(e => e.Idrabatt) entity.ToTable("rabatt");
.ValueGeneratedNever()
.HasColumnType("int(11)")
.HasColumnName("IDRabatt");
entity.Property(e => e.GueltigkeitBis).HasColumnType("datetime");
entity.Property(e => e.GueltigkeitVon).HasColumnType("datetime");
entity.Property(e => e.Prozent).HasPrecision(8, 2);
});
modelBuilder.Entity<Admin>(entity => entity.Property(e => e.Idrabatt)
{ .ValueGeneratedNever()
entity.HasKey(e => e.Id).HasName("PRIMARY"); .HasColumnType("int(11)")
entity.ToTable("admin"); .HasColumnName("IDRabatt");
entity.Property(e => e.Id) entity.Property(e => e.GueltigkeitBis).HasColumnType("datetime");
.ValueGeneratedNever() entity.Property(e => e.GueltigkeitVon).HasColumnType("datetime");
.HasColumnType("int(11)") entity.Property(e => e.Prozent).HasPrecision(8, 2);
.HasColumnName("Id"); });
entity.Property(e => e.Username).HasMaxLength(100);
entity.Property(e => e.Password).HasMaxLength(100);
});
//modelBuilder.Entity<BestellungspositionHasMenuitem>(entity => modelBuilder.Entity<Admin>(entity =>
//{ {
// entity.HasKey(e => new { e.BestellungspositionId, e.MenuitemId }) entity.HasKey(e => e.Id).HasName("PRIMARY");
// .HasName("PRIMARY"); entity.ToTable("admin");
});
// entity.ToTable("bestellungsposition_has_menuitem"); OnModelCreatingPartial(modelBuilder);
}
// entity.Property(e => e.BestellungspositionId).HasColumnType("int(11)");
// entity.Property(e => e.MenuitemId).HasColumnType("int(11)");
//});
modelBuilder.Entity<MenuitemHasAllergie>(entity =>
{
entity.HasKey(e => new { e.MenuItem_IDMenuItem, e.Allergie_IDAllergie })
.HasName("PRIMARY");
entity.ToTable("menuitem_has_allergie");
entity.Property(e => e.MenuItem_IDMenuItem).HasColumnType("int(11)");
entity.Property(e => e.Allergie_IDAllergie).HasColumnType("int(11)");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
} }

View File

@ -1,11 +0,0 @@
namespace WebApi.Models
{
public class MenuitemHasAllergie
{
// navigation references Menuitem
public int? MenuItem_IDMenuItem { get; set; }
// navigation references Allergie
public int? Allergie_IDAllergie { get; set; }
}
}

View File

@ -0,0 +1,12 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Y4FDB": "Server=localhost;Database=y4f;Uid=user;Pwd=user"
}
}

View File

@ -1,60 +1,23 @@
@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;'> <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%;"> <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> <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">
<button type="submit" id="button1" class="btn">QR-Code einscannen</button> <button type="submit" id="button1" class="btn">QR-Code einscannen</button>
<input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode" @bind-value="@qrcodeValue"> <input type="text" class="form-control" id="qrcode" placeholder="Zugangscode eintragen" name="qrcode">
<button type="submit" id="button1" class="btn">Bestätigen</button>
</div>
<button type="submit" id="button1" class="btn" @onclick="@(() => CheckCode())">Bestätigen</button>
</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,293 +1,129 @@
@page "/shopping_cart" @page "/shopping_cart"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<PageTitle>Warenkorb</PageTitle> <PageTitle>Warenkorb</PageTitle>
<h1>Warenkorb</h1> <h1>Warenkorb</h1>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
</div> </div>
</div> </div>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-12 col-lg-6"> <div class="col-sm-12 col-lg-6">
@*Tabelle Ihre Bestellung*@ @*Tabelle Ihre Bestellung*@
<div class="tbl-container"> <div class="tbl-container">
<table class="table bdr"> <table class="table bdr">
<thead class="bg_green"> <thead class="bg_green">
<tr> <tr>
<td>Ihre Bestellung</td> <td>Ihre Bestellung</td>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody class="bg_lightgreen"> <tbody class="bg_lightgreen">
@if (menuitemIds.Count == 0) <tr>
{ <td class="br" style="padding-top:20px; padding-bottom:0px; border-bottom-width: 0px;">
<div class="card-body"> 1 Nudel mit Hühnerfleisch (groß)
<h5 class="card-title" style="font-size:10pt; margin-bottom:0px;">Warenkorb ist leer</h5> <div style="font-size:0.7rem;padding-left:15px;">mit Knoblauchsoße</div>
</div> </td>
} <td class="d-flex justify-content-center align-items-center" style="padding-top:20px; padding-bottom:0px;">9,10€</td>
else </tr>
{ <tr>
@foreach (var item in menuitemIds) <td class="br" style=" padding-top:0px; border-bottom-width: 0px;">1 Coca Cola</td>
{ <td class="d-flex justify-content-center align-items-center" style="padding-top:0px;">2,50€</td>
@foreach (var item2 in menuitems) </tr>
{ <tr>
@if (item.Key == item2.IdmenuItem) <td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
{ <td class="d-flex justify-content-center align-items-center"></td>
<tr> </tr>
<tr>
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
<td class="d-flex justify-content-center align-items-center"></td>
</tr>
<tr>
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
<td class="d-flex justify-content-center align-items-center"></td>
</tr>
<tr>
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
<td class="d-flex justify-content-center align-items-center"></td>
</tr>
<tr>
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
<td class="d-flex justify-content-center align-items-center"></td>
</tr>
<tr>
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
<td class="d-flex justify-content-center align-items-center"></td>
</tr>
<tr>
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
<td class="d-flex justify-content-center align-items-center"></td>
</tr>
<tr>
<td class="br" style=" padding-top:0px; border-bottom-width: 0px;"></td>
<td class="d-flex justify-content-center align-items-center" style="border-bottom-width: 0px;"></td>
</tr>
</tbody>
<tfoot class="bg_lightgreen">
<tr style="border-top:solid 1px black;">
<th class="" style="text-align:right;">Summe</th>
<td class="d-flex justify-content-center align-items-center">11,60€</td>
</tr>
</tfoot>
</table>
<td class="br" style="padding-top:20px; padding-bottom:0px; border-bottom-width: 0px;"> </div>
@item.Value x
@item2.Bezeichnung
<button @onclick="@(() => DelMenuItemId(item.Key))" class="btn btn-danger">del</button>
</div>
<div class="col-sm-12 col-lg-6">
<div class="h-100">
@*Essen Abholen?*@
<div class="row h-25 w-100">
<div class="col">
<div class="d-flex flex-column align-items-center ">
<div class="tbl-container bdr w-100">
<!-- <== overflow: hidden applied to parent -->
<table class="table bdr" cellspacing="0" cellpadding="0">
<thead class="bg_green">
<tr>
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
Wann wollen Sie Ihr Essen abholen?
</td>
</tr>
</thead>
<tbody class="bg_lightgreen">
<tr>
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px;">
<div style="margin:20px;">
<div class="d-flex justify-content-center align-items-center">
<input type="number" style="width:80px" min="10" max="20" />
<input type="number" style="width:80px" min="0" max="59" />
&nbsp;
Uhr
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div style="font-size:0.7rem;padding-left:15px;">@item2.Zusatzinformation</div> @*Buttons*@
</td> <div class="row h-75 w-100">
<td class="d-flex justify-content-center align-items-center" style="padding-top:20px; border-bottom-width:0px;">@(item2.Preis * item.Value)€</td> <div class="col mt-auto">
</tr> <div class="d-flex flex-column align-items-center ">
} <button class="btn_back w-75">Zurück</button>
} <button class="btn_forward w-75">Weiter</button>
</div>
} </div>
} </div>
</tbody> </div>
<tfoot class="bg_lightgreen"> </div>
<tr style="border-top:solid 1px black;"> </div>
<th class="" style="text-align:right;">Summe</th>
<td class="d-flex justify-content-center align-items-center">
@summe€
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="col-sm-12 col-lg-6">
<div class="h-100">
@*Essen Abholen?*@
<div class="row h-25 w-100 ">
<div class="col">
<div class="d-flex flex-column align-items-center ">
<div class="tbl-container bdr w-100">
<!-- <== overflow: hidden applied to parent -->
<table class="table bdr" cellspacing="0" cellpadding="0">
<thead class="bg_green">
<tr>
<td class="d-flex justify-content-center align-items-center" style="border-bottom:0px;">
Wann wollen Sie Ihr Essen abholen?
</td>
</tr>
</thead>
<tbody class="bg_lightgreen">
<tr>
<td class="d-flex justify-content-center align-items-center" style="padding-top:0px;">
<div style="margin:20px;">
<div class="d-flex justify-content-center align-items-center">
<input type="number" style="width:80px" min="10" max="19" />
<input type="number" style="width:80px" min="0" max="59" />
&nbsp;
Uhr
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
@*Buttons*@
<div class="row h-75 w-100">
<div class="col mt-auto ">
<div class="d-flex flex-column align-items-center ">
<a href="/speisekarte" class="btn_bg w-75 btn text-center">Zurück</a>
<a href="#" class="btn_forward btn w-75 ">Weiter</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div> </div>
@code {
public decimal summe;
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);
}
private void DelMenuItemId(int id)
{
if (menuitemIds.ContainsKey(id))
{
if (menuitemIds[id] > 1)
{
menuitemIds[id]--;
}
else
{
menuitemIds.Remove(id);
}
}
localStorage.SetItem<Dictionary<int, int>>("MenuItemIds", menuitemIds);
_navigationManager.NavigateTo(_navigationManager.Uri, forceLoad: true);
}
// 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>();
private List<Rabatt> rabatte = new List<Rabatt>();
protected override async Task OnInitializedAsync()
{
// get data from localstorage
if (localStorage.GetItem<Dictionary<int, int>>("MenuItemIds") != null)
{
menuitemIds = localStorage.GetItem<Dictionary<int, int>>("MenuItemIds");
}
// 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");
// calculate the sum of all menuitems
summe = 0;
foreach (var item in menuitemIds)
{
foreach (var item2 in menuitems)
{
if (item.Key == item2.IdmenuItem)
{
summe += item2.Preis * item.Value;
}
}
}
}
public class Allergie
{
public int Idallergie { get; set; }
public string? Beschreibung { get; set; }
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Bestellungsposition
{
public int Idbestellung { get; set; }
public int? Menge { get; set; }
public DateTime? Datum { get; set; }
public int KundeIdkunde { get; set; }
public int RabattIdrabatt { get; set; }
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
public virtual Rabatt RabattIdrabattNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Kunde
{
public int Idkunde { get; set; }
public string? Code { get; set; }
public int? Treuepunkte { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
public class Menuitem
{
public int IdmenuItem { get; set; }
public string? Bezeichnung { get; set; }
public string? Zusatzinformation { get; set; }
public decimal Preis { get; set; }
public int MenuItemKategorieIdmenuItemKategorie { get; set; }
public virtual Menuitemkategorie MenuItemKategorieIdmenuItemKategorieNavigation { get; set; } = null!;
public virtual ICollection<Allergie> AllergieIdallergies { get; set; } = new List<Allergie>();
public virtual ICollection<Bestellungsposition> BestellungspositionIdbestellungs { get; set; } = new List<Bestellungsposition>();
}
public class Menuitemkategorie
{
public int IdmenuItemKategorie { get; set; }
public string? Bezeichnung { get; set; }
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
public virtual Menuitemueberkategorie MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> Menuitems { get; set; } = new List<Menuitem>();
}
public class Menuitemueberkategorie
{
public int IdmenuItemUeberkategorie { get; set; }
public string? Bezeichnung { get; set; }
public virtual ICollection<Menuitemkategorie> Menuitemkategories { get; set; } = new List<Menuitemkategorie>();
}
public class Rabatt
{
public int Idrabatt { get; set; }
public decimal? Prozent { get; set; }
public DateTime? GueltigkeitVon { get; set; }
public DateTime? GueltigkeitBis { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
}

View File

@ -1,127 +1,124 @@
@page "/Speisekarte" @page "/Speisekarte"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
@inject NavigationManager _navigationManager
<h1>Speisekarte</h1>
<div class="row justify-content-center"> <div class="row justify-content-center">
@foreach (var item in menuitemueberkategories) <div class="col-lg-2 col-md-4 col-sm-12 tablecolumn">
{ <table class="table table-light overflow-hidden">
<div class="col-lg-2 col-md-4 col-sm-12 tablecolumn"> <thead>
<table class="table table-light overflow-hidden"> <tr>
<thead> <th scope="col">Chinesisch</th>
<tr> </tr>
<th scope="col">@item.Bezeichnung</th> </thead>
</tr> <tbody>
</thead> <tr>
<tbody> <td><a href="">Nudeln</a></td>
@foreach (var item2 in menuitemkategories) </tr>
{ <tr>
if (item.IdmenuItemUeberkategorie == item2.MenuItemUeberkategorieIdmenuItemUeberkategorie) <td><a href="">Reis</a></td>
{ </tr>
if (@item.Bezeichnung == "Chinesisch") <tr>
{ <td class="lowest"><a href="">Nachspeisen</a></td>
<tr> </tr>
<td><a href="/SpeisekarteChinesich">@item2.Bezeichnung</a></td> <tr>
</tr> <td class="lowest"><br></td>
} </tr>
else if (@item.Bezeichnung == "Japanisch") <tr>
{ <td class="lowest"><br></td>
<tr> </tr>
<td><a href="/SpeisekarteJapanisch">@item2.Bezeichnung</a></td> <tr>
</tr> <td class="lowest"><br></td>
} </tr>
else if (@item.Bezeichnung == "Getränke") </tbody>
{ </table>
<tr> </div>
<td><a href="/SpeisekarteGetraenke">@item2.Bezeichnung</a></td> <div class="col-lg-2 col-md-4 col-sm-12 tablecolumn">
</tr> <table class="table table-light overflow-hidden">
} <thead>
else if (@item.Bezeichnung == "Sonstiges") <tr>
{ <th scope="col">Japanisch</th>
<tr> </tr>
<td><a href="/SpeisekarteSonstiges">@item2.Bezeichnung</a></td> </thead>
</tr> <tbody>
} <tr>
else <td><a href="">Sushi & Maki</a></td>
{ </tr>
<tr> <tr>
<td><a href="/">@item2.Bezeichnung</a></td> <td><a href="">Bento</a></td>
</tr> </tr>
} <tr>
} <td class="lowest"><a href="">Nachspeisen</a></td>
} </tr>
<tr> <tr>
<td class="lowest"><br></td> <td class="lowest"><br></td>
</tr> </tr>
<tr> <tr>
<td class="lowest"><br></td> <td class="lowest"><br></td>
</tr>
</tr> <tr>
<tr> <td class="lowest"><br></td>
<td class="lowest"><br></td> </tr>
</tr> </tbody>
</tbody> </table>
</table> </div>
</div> <div class="col-lg-2 col-md-4 col-sm-12 tablecolumn">
} <table class="table table-light overflow-hidden">
<thead>
<tr>
<th scope="col">Getränke</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="">Alkoholfrei</a></td>
</tr>
<tr>
<td class="lowest"><a href="">Alkoholisch</a></td>
</tr>
<tr>
<td class="lowest"><br></td>
</tr>
<tr>
<td class="lowest"><br></td>
</tr>
<tr>
<td class="lowest"><br></td>
</tr>
<tr>
<td class="lowest"><br></td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-2 col-md-4 col-sm-12 tablecolumn">
<table class="table table-light overflow-hidden">
<thead>
<tr>
<th scope="col">Sonstiges</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="">Schnitzel</a></td>
</tr>
<tr>
<td><a href="">Pommes</a></td>
</tr>
<tr>
<td class="lowest"><a href="">Bowl</a></td>
</tr>
<tr>
<td class="lowest"><br></td>
</tr>
<tr>
<td class="lowest"><br></td>
</tr>
<tr>
<td class="lowest"><br></td>
</tr>
</tbody>
</table>
</div>
</div> </div>
@code { @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
{
public int IdmenuItemKategorie { get; set; }
public string Bezeichnung { get; set; }
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
public object MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; }
public List<object> MenuItemIdmenuItems { get; set; }
}
public class Menuitemueberkategorie
{
public int IdmenuItemUeberkategorie { get; set; }
public string Bezeichnung { get; set; }
public List<object> MenuItemKategorieIdmenuItemKategories { get; set; }
public List<object> MenuItemIdmenuItems { get; set; }
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
} }

View File

@ -1,229 +0,0 @@
@page "/SpeisekarteChinesich"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Chinesisch</h1>
<div class="container">
<div class="row">
<div class="col-8">
<div class="btn-group d-flex" role="group">
<button type="button" class="btn">Chinesisch</button>
<button type="button" class="btn">Nudel</button>
<button type="button" class="btn">Reis</button>
<button type="button" class="btn">Nachspeise</button>
</div>
@foreach (var item in menuitemueberkategories)
{
@if (item.Bezeichnung == "Chinesisch")
{
@foreach (var item2 in menuitemkategories)
{
if (item2.MenuItemUeberkategorieIdmenuItemUeberkategorie == item.IdmenuItemUeberkategorie)
{
@foreach (var item3 in menuitems)
{
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3 " @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
<div class="col-8">
<h5 class="card-title">@item3.Bezeichnung</h5>
<p class="card-text">@item3.Zusatzinformation</p>
</div>
@*div text center*@
<div class="col-4 d-flex justify-content-center align-items-center">
<div style="font-size:15pt;">@item3.Preis</div>
</div>
</div>
</div>
</div>
}
}
}
}
}
}
</div>
<div class="col-4">
@* warenkorb anzeige als bootstrap card*@
<div class="card">
<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;">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">
<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 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>();
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>();
private List<Rabatt> rabatte = new List<Rabatt>();
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");
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");
}
public class Allergie
{
public int Idallergie { get; set; }
public string? Beschreibung { get; set; }
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Bestellungsposition
{
public int Idbestellung { get; set; }
public int? Menge { get; set; }
public DateTime? Datum { get; set; }
public int KundeIdkunde { get; set; }
public int RabattIdrabatt { get; set; }
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
public virtual Rabatt RabattIdrabattNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Kunde
{
public int Idkunde { get; set; }
public string? Code { get; set; }
public int? Treuepunkte { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
public class Menuitem
{
public int IdmenuItem { get; set; }
public string? Bezeichnung { get; set; }
public string? Zusatzinformation { get; set; }
public decimal? Preis { get; set; }
public int MenuItemKategorieIdmenuItemKategorie { get; set; }
public virtual Menuitemkategorie MenuItemKategorieIdmenuItemKategorieNavigation { get; set; } = null!;
public virtual ICollection<Allergie> AllergieIdallergies { get; set; } = new List<Allergie>();
public virtual ICollection<Bestellungsposition> BestellungspositionIdbestellungs { get; set; } = new List<Bestellungsposition>();
}
public class Menuitemkategorie
{
public int IdmenuItemKategorie { get; set; }
public string? Bezeichnung { get; set; }
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
public virtual Menuitemueberkategorie MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> Menuitems { get; set; } = new List<Menuitem>();
}
public class Menuitemueberkategorie
{
public int IdmenuItemUeberkategorie { get; set; }
public string? Bezeichnung { get; set; }
public virtual ICollection<Menuitemkategorie> Menuitemkategories { get; set; } = new List<Menuitemkategorie>();
}
public class Rabatt
{
public int Idrabatt { get; set; }
public decimal? Prozent { get; set; }
public DateTime? GueltigkeitVon { get; set; }
public DateTime? GueltigkeitBis { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
}

View File

@ -1,81 +0,0 @@
/**{
background-color: red;
}*/
/*navigation*/
button.btn:first-child {
background-color: #8bfaa4;
/*not click able*/
pointer-events: none;
cursor: default;
border-width: 0px;
}
button.btn {
/* Verwirrung: Figma-Design: background-color: #c7ffd5;
wurde jetzt aber fuer den Hintergrund verwendet*/
background-color: #8dffb5;
border-right: 1px solid black;
border-left: 1px solid black;
border-radius:20px;
}
button.btn:nth-child(2) {
/*border-right: 2px solid black;*/
border-left-width: 0px;
}
button.btn:last-child {
border-right-width: 0px;
}
/*menuitems*/
.card.mt-3 {
/* background-color: rebeccapurple; */
border-radius: 30px;
border: 1px solid black;
}
/*warenkorb*/
.card-header {
font-size:16pt;
text-align: center;
padding-bottom: 15px;
/* background-color: white; */
border-top-right-radius: 20px;
}
.card-header {
background-color:transparent;
border-bottom-width:0px;
}
.card {
border-radius: 32px;
border: 1px solid black;
}
p.card-text {
margin-left: 20px;
}
/*buttons*/
a.btn.btn-primary.mx-2.mt-5 {
background-color: #facca3;
color: black;
border: none;
border-radius: 20px;
}
a.btn.btn-primary.mx-2.mt-1 {
background-color: #89f9a5;
color: black;
border: none;
border-radius: 20px;
}

View File

@ -1,235 +0,0 @@
@page "/SpeisekarteGetraenke"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Getränke</h1>
@* create an container bootstrap 5*@
<div class="container">
<div class="row">
<div class="col-8">
@* Navigation button group, stretch on the width size of the col-8 *@
<div class="btn-group d-flex" role="group">
<button type="button" class="btn">Getränke</button>
<button type="button" class="btn">Alkoholfreie Getränke</button>
<button type="button" class="btn">Bier</button>
</div>
@foreach (var item in menuitemueberkategories)
{
@if (item.Bezeichnung == "Getränke")
{
@foreach (var item2 in menuitemkategories)
{
if (item2.MenuItemUeberkategorieIdmenuItemUeberkategorie == item.IdmenuItemUeberkategorie)
{
@foreach (var item3 in menuitems)
{
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3 " @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
<div class="col-8">
<h5 class="card-title">@item3.Bezeichnung</h5>
<p class="card-text">@item3.Zusatzinformation</p>
</div>
@*div text center*@
<div class="col-4 d-flex justify-content-center align-items-center">
<div style="font-size:15pt;">@item3.Preis</div>
</div>
</div>
</div>
</div>
}
}
}
}
}
}
</div>
<div class="col-4">
@* warenkorb anzeige als bootstrap card*@
<div class="card">
<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;">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">
<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 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>();
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>();
private List<Rabatt> rabatte = new List<Rabatt>();
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");
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");
}
public class Allergie
{
public int Idallergie { get; set; }
public string? Beschreibung { get; set; }
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Bestellungsposition
{
public int Idbestellung { get; set; }
public int? Menge { get; set; }
public DateTime? Datum { get; set; }
public int KundeIdkunde { get; set; }
public int RabattIdrabatt { get; set; }
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
public virtual Rabatt RabattIdrabattNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Kunde
{
public int Idkunde { get; set; }
public string? Code { get; set; }
public int? Treuepunkte { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
public class Menuitem
{
public int IdmenuItem { get; set; }
public string? Bezeichnung { get; set; }
public string? Zusatzinformation { get; set; }
public decimal? Preis { get; set; }
public int MenuItemKategorieIdmenuItemKategorie { get; set; }
public virtual Menuitemkategorie MenuItemKategorieIdmenuItemKategorieNavigation { get; set; } = null!;
public virtual ICollection<Allergie> AllergieIdallergies { get; set; } = new List<Allergie>();
public virtual ICollection<Bestellungsposition> BestellungspositionIdbestellungs { get; set; } = new List<Bestellungsposition>();
}
public class Menuitemkategorie
{
public int IdmenuItemKategorie { get; set; }
public string? Bezeichnung { get; set; }
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
public virtual Menuitemueberkategorie MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> Menuitems { get; set; } = new List<Menuitem>();
}
public class Menuitemueberkategorie
{
public int IdmenuItemUeberkategorie { get; set; }
public string? Bezeichnung { get; set; }
public virtual ICollection<Menuitemkategorie> Menuitemkategories { get; set; } = new List<Menuitemkategorie>();
}
public class Rabatt
{
public int Idrabatt { get; set; }
public decimal? Prozent { get; set; }
public DateTime? GueltigkeitVon { get; set; }
public DateTime? GueltigkeitBis { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
}

View File

@ -1,81 +0,0 @@
/**{
background-color: red;
}*/
/*navigation*/
button.btn:first-child {
background-color: #8bfaa4;
/*not click able*/
pointer-events: none;
cursor: default;
border-width: 0px;
}
button.btn {
/* Verwirrung: Figma-Design: background-color: #c7ffd5;
wurde jetzt aber fuer den Hintergrund verwendet*/
background-color: #8dffb5;
border-right: 1px solid black;
border-left: 1px solid black;
border-radius: 20px;
}
button.btn:nth-child(2) {
/*border-right: 2px solid black;*/
border-left-width: 0px;
}
button.btn:last-child {
border-right-width: 0px;
}
/*menuitems*/
.card.mt-3 {
/* background-color: rebeccapurple; */
border-radius: 30px;
border: 1px solid black;
}
/*warenkorb*/
.card-header {
font-size: 16pt;
text-align: center;
padding-bottom: 15px;
/* background-color: white; */
border-top-right-radius: 20px;
}
.card-header {
background-color: transparent;
border-bottom-width: 0px;
}
.card {
border-radius: 32px;
border: 1px solid black;
}
p.card-text {
margin-left: 20px;
}
/*buttons*/
a.btn.btn-primary.mx-2.mt-5 {
background-color: #facca3;
color: black;
border: none;
border-radius: 20px;
}
a.btn.btn-primary.mx-2.mt-1 {
background-color: #89f9a5;
color: black;
border: none;
border-radius: 20px;
}

View File

@ -1,230 +0,0 @@
@page "/SpeisekarteSonstiges"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Sonstiges</h1>
@* create an container bootstrap 5*@
<div class="container">
<div class="row">
<div class="col-8">
@* Navigation button group, stretch on the width size of the col-8 *@
<div class="btn-group d-flex" role="group">
<button type="button" class="btn">Sonstiges</button>
<button type="button" class="btn">Schnitzel</button>
<button type="button" class="btn">Pommes</button>
<button type="button" class="btn">Bowl</button>
<button type="button" class="btn">Vorspeisen</button>
</div>
@foreach (var item in menuitemueberkategories)
{
@if (item.Bezeichnung == "Sonstiges")
{
@foreach (var item2 in menuitemkategories)
{
if (item2.MenuItemUeberkategorieIdmenuItemUeberkategorie == item.IdmenuItemUeberkategorie)
{
@foreach (var item3 in menuitems)
{
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3 " @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
<div class="col-8">
<h5 class="card-title">@item3.Bezeichnung</h5>
<p class="card-text">@item3.Zusatzinformation</p>
</div>
@*div text center*@
<div class="col-4 d-flex justify-content-center align-items-center">
<div style="font-size:15pt;">@item3.Preis</div>
</div>
</div>
</div>
</div>
}
}
}
}
}
}
</div>
<div class="col-4">
@* warenkorb anzeige als bootstrap card*@
<div class="card">
<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;">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">
<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 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>();
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>();
private List<Rabatt> rabatte = new List<Rabatt>();
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");
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");
}
public class Allergie
{
public int Idallergie { get; set; }
public string? Beschreibung { get; set; }
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Bestellungsposition
{
public int Idbestellung { get; set; }
public int? Menge { get; set; }
public DateTime? Datum { get; set; }
public int KundeIdkunde { get; set; }
public int RabattIdrabatt { get; set; }
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
public virtual Rabatt RabattIdrabattNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Kunde
{
public int Idkunde { get; set; }
public string? Code { get; set; }
public int? Treuepunkte { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
public class Menuitem
{
public int IdmenuItem { get; set; }
public string? Bezeichnung { get; set; }
public string? Zusatzinformation { get; set; }
public decimal? Preis { get; set; }
public int MenuItemKategorieIdmenuItemKategorie { get; set; }
public virtual Menuitemkategorie MenuItemKategorieIdmenuItemKategorieNavigation { get; set; } = null!;
public virtual ICollection<Allergie> AllergieIdallergies { get; set; } = new List<Allergie>();
public virtual ICollection<Bestellungsposition> BestellungspositionIdbestellungs { get; set; } = new List<Bestellungsposition>();
}
public class Menuitemkategorie
{
public int IdmenuItemKategorie { get; set; }
public string? Bezeichnung { get; set; }
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
public virtual Menuitemueberkategorie MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> Menuitems { get; set; } = new List<Menuitem>();
}
public class Menuitemueberkategorie
{
public int IdmenuItemUeberkategorie { get; set; }
public string? Bezeichnung { get; set; }
public virtual ICollection<Menuitemkategorie> Menuitemkategories { get; set; } = new List<Menuitemkategorie>();
}
public class Rabatt
{
public int Idrabatt { get; set; }
public decimal? Prozent { get; set; }
public DateTime? GueltigkeitVon { get; set; }
public DateTime? GueltigkeitBis { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
}

View File

@ -1,81 +0,0 @@
/**{
background-color: red;
}*/
/*navigation*/
button.btn:first-child {
background-color: #8bfaa4;
/*not click able*/
pointer-events: none;
cursor: default;
border-width: 0px;
}
button.btn {
/* Verwirrung: Figma-Design: background-color: #c7ffd5;
wurde jetzt aber fuer den Hintergrund verwendet*/
background-color: #8dffb5;
border-right: 1px solid black;
border-left: 1px solid black;
border-radius: 20px;
}
button.btn:nth-child(2) {
/*border-right: 2px solid black;*/
border-left-width: 0px;
}
button.btn:last-child {
border-right-width: 0px;
}
/*menuitems*/
.card.mt-3 {
/* background-color: rebeccapurple; */
border-radius: 30px;
border: 1px solid black;
}
/*warenkorb*/
.card-header {
font-size: 16pt;
text-align: center;
padding-bottom: 15px;
/* background-color: white; */
border-top-right-radius: 20px;
}
.card-header {
background-color: transparent;
border-bottom-width: 0px;
}
.card {
border-radius: 32px;
border: 1px solid black;
}
p.card-text {
margin-left: 20px;
}
/*buttons*/
a.btn.btn-primary.mx-2.mt-5 {
background-color: #facca3;
color: black;
border: none;
border-radius: 20px;
}
a.btn.btn-primary.mx-2.mt-1 {
background-color: #89f9a5;
color: black;
border: none;
border-radius: 20px;
}

View File

@ -1,231 +0,0 @@
@page "/SpeisekarteJapanisch"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<h1>Speisekarte Japanisch</h1>
@* create an container bootstrap 5*@
<div class="container">
<div class="row">
<div class="col-8">
@* Navigation button group, stretch on the width size of the col-8 *@
<div class="btn-group d-flex" role="group">
<button type="button" class="btn">Japanisch</button>
<button type="button" class="btn">SushiMaki</button>
<button type="button" class="btn">Bento</button>
<button type="button" class="btn">Nachspeise</button>
</div>
@foreach (var item in menuitemueberkategories)
{
@if (item.Bezeichnung == "Japanisch")
{
@foreach (var item2 in menuitemkategories)
{
if (item2.MenuItemUeberkategorieIdmenuItemUeberkategorie == item.IdmenuItemUeberkategorie)
{
@foreach (var item3 in menuitems)
{
if (item2.IdmenuItemKategorie == item3.MenuItemKategorieIdmenuItemKategorie)
{
<div class="card mt-3" @onclick="@(() => SetMenuItemId(item3.IdmenuItem))">
<div class="card-body">
@*create two divs columns*@
<div class="row">
<div class="col-8">
<h5 class="card-title">@item3.Bezeichnung</h5>
<p class="card-text">@item3.Zusatzinformation</p>
</div>
@*div text center*@
<div class="col-4 d-flex justify-content-center align-items-center">
<div style="font-size:15pt;">@item3.Preis</div>
</div>
</div>
</div>
</div>
}
}
}
}
}
}
</div>
<div class="col-4">
@* warenkorb anzeige als bootstrap card*@
<div class="card">
<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;">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">
<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 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>();
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>();
private List<Rabatt> rabatte = new List<Rabatt>();
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");
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");
}
public class Allergie
{
public int Idallergie { get; set; }
public string? Beschreibung { get; set; }
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Bestellungsposition
{
public int Idbestellung { get; set; }
public int? Menge { get; set; }
public DateTime? Datum { get; set; }
public int KundeIdkunde { get; set; }
public int RabattIdrabatt { get; set; }
public virtual Kunde KundeIdkundeNavigation { get; set; } = null!;
public virtual Rabatt RabattIdrabattNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> MenuItemIdmenuItems { get; set; } = new List<Menuitem>();
}
public class Kunde
{
public int Idkunde { get; set; }
public string? Code { get; set; }
public int? Treuepunkte { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
public class Menuitem
{
public int IdmenuItem { get; set; }
public string? Bezeichnung { get; set; }
public string? Zusatzinformation { get; set; }
public decimal? Preis { get; set; }
public int MenuItemKategorieIdmenuItemKategorie { get; set; }
public virtual Menuitemkategorie MenuItemKategorieIdmenuItemKategorieNavigation { get; set; } = null!;
public virtual ICollection<Allergie> AllergieIdallergies { get; set; } = new List<Allergie>();
public virtual ICollection<Bestellungsposition> BestellungspositionIdbestellungs { get; set; } = new List<Bestellungsposition>();
}
public class Menuitemkategorie
{
public int IdmenuItemKategorie { get; set; }
public string? Bezeichnung { get; set; }
public int MenuItemUeberkategorieIdmenuItemUeberkategorie { get; set; }
public virtual Menuitemueberkategorie MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation { get; set; } = null!;
public virtual ICollection<Menuitem> Menuitems { get; set; } = new List<Menuitem>();
}
public class Menuitemueberkategorie
{
public int IdmenuItemUeberkategorie { get; set; }
public string? Bezeichnung { get; set; }
public virtual ICollection<Menuitemkategorie> Menuitemkategories { get; set; } = new List<Menuitemkategorie>();
}
public class Rabatt
{
public int Idrabatt { get; set; }
public decimal? Prozent { get; set; }
public DateTime? GueltigkeitVon { get; set; }
public DateTime? GueltigkeitBis { get; set; }
public virtual ICollection<Bestellungsposition> Bestellungspositions { get; set; } = new List<Bestellungsposition>();
}
}

View File

@ -1,81 +0,0 @@
/**{
background-color: red;
}*/
/*navigation*/
button.btn:first-child {
background-color: #8bfaa4;
/*not click able*/
pointer-events: none;
cursor: default;
border-width: 0px;
}
button.btn {
/* Verwirrung: Figma-Design: background-color: #c7ffd5;
wurde jetzt aber fuer den Hintergrund verwendet*/
background-color: #8dffb5;
border-right: 1px solid black;
border-left: 1px solid black;
border-radius: 20px;
}
button.btn:nth-child(2) {
/*border-right: 2px solid black;*/
border-left-width: 0px;
}
button.btn:last-child {
border-right-width: 0px;
}
/*menuitems*/
.card.mt-3 {
/* background-color: rebeccapurple; */
border-radius: 30px;
border: 1px solid black;
}
/*warenkorb*/
.card-header {
font-size: 16pt;
text-align: center;
padding-bottom: 15px;
/* background-color: white; */
border-top-right-radius: 20px;
}
.card-header {
background-color: transparent;
border-bottom-width: 0px;
}
.card {
border-radius: 32px;
border: 1px solid black;
}
p.card-text {
margin-left: 20px;
}
/*buttons*/
a.btn.btn-primary.mx-2.mt-5 {
background-color: #facca3;
color: black;
border: none;
border-radius: 20px;
}
a.btn.btn-primary.mx-2.mt-1 {
background-color: #89f9a5;
color: black;
border: none;
border-radius: 20px;
}

View File

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

View File

@ -14,7 +14,6 @@
</div> </div>
<table> <table>
<tr class="loadtext"> <tr class="loadtext">
<td>Bestellung eingegangen</td> <td>Bestellung eingegangen</td>
<td class="load2">Bestellung wird zubereitet</td> <td class="load2">Bestellung wird zubereitet</td>

View File

@ -5,7 +5,7 @@
<div class="container mt-auto"> <div class="container mt-auto">
<h4>AccountID: @RegistrierungA.userName</h4> <h4>AccountID: #1234</h4>
<h4>Ihr QR-Code: </h4> <h4>Ihr QR-Code: </h4>
<img src="assets/K-QR.png" class="img" title="logo image"> <img src="assets/K-QR.png" class="img" title="logo image">

View File

@ -1,36 +1,22 @@
@page "/RegistrierungA" @page "/RegistrierungA"
@layout Registrierung @layout Registrierung
@inject NavigationManager NavManager
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<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">
<p>Benutzername:</p> <p>Benutzername:</p>
<center>
<input type="text" class="form-control" id="name" name="name" @bind="@inputName"> <input type="text" class="form-control" id="name" name="name">
</center>
<p>Passwort:</p> <p>Passwort:</p>
<input type="password" class="form-control" id="password" name="password" @bind="@inputPassword"> <center>
<input type="text" class="form-control" id="password" name="password">
<button type="button" class="btn" @onclick="@Login">Login</button> </center>
<center>
<form id="button" action="Bestelluebersicht">
<input type="submit" value="Login" class="btn">
</form>
</center>
</div> </div>
@code { @code {
public string inputName { get; set; } = string.Empty;
public string inputPassword { get; set; } = string.Empty;
public static string userName { get; set; } = string.Empty;
public void Login() {
if (inputName == userDataName && inputPassword == userDataPassword) {
localStorage.SetItem("name", inputName);
userName = localStorage.GetItem<string>("name");
NavManager.NavigateTo("/Bestelluebersicht");
}
}
}
@code {
public string userDataName { get; set; } = "";
public string userDataPassword { get; set; } = "";
} }

View File

@ -15,8 +15,5 @@ input {
} }
button {
text-align: center;
background-color: #89F9A5;
border-radius: 50px;
}

View File

@ -1,105 +1,29 @@
@page "/Yummy-Punkte" @page "/Yummy-Punkte"
@inject HttpClient Http
@inject Blazored.LocalStorage.ISyncLocalStorageService localStorage
<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><b>Ihre Yummy-Punkte</b></h4> <h4><b>Ihre Yummy-Punkte</b></h4>
<div class="img"> <div class="img" >
@for (int i = 0; i < 10; i++) @for(int i = 0; i < 10; i++)
{ {
@*if kunde hat treuepunkte*@ <img src="assets/White-Circle.png ">
@if (kunde.Treuepunkte > i) }
{ <br>
<img src="assets/Point-Circle.png "> </div>
}
else
{
<img src="assets/White-Circle.png ">
}
}
<br>
</div>
<p class="text">Bei einem Mindestbestellwert von 8€ erhalten Sie ein Yummy-Punkt. Ab der 10ten Bestellung gibt es einen Rabatt zu Ihrer nächsten Bestellung.</p> <p class="text">Bei einem Mindestbestellwert von 8€ erhalten Sie ein Yummy-Punkt. Ab der 10ten Bestellung gibt es einen Rabatt zu Ihrer nächsten Bestellung.</p>
<p class="text">Aktueller Rabatt: @rabatt.Prozent %</p>
<div class="button"> <div class="button">
<form id="button1" action="/"> <form id="button1" action="/">
<input type="submit" value="Zurück" class="btn"> <input type="submit" value="Zurück" class="btn">
</form> </form>
@*reset button to set the treuepunkte to null*@ </div>
<button class="btn btn-danger" @onclick="@(()=>resetTreuepunkte())">Yummy-Punkte einlösen</button>
</div> </div>
</div>
</body> </body>
@code { @code {
// allergien, bestellungsposition, kunde, menuitem, menuitemkategorie, menuitemueberkategorie, rabatt
private List<Kunde> kunden = new List<Kunde>();
private Kunde kunde = new Kunde();
private List<Rabatt> rabatte = new List<Rabatt>();
private Rabatt rabatt = new Rabatt();
public void resetTreuepunkte()
{
if (kunde.Treuepunkte == 10)
{
kunde.Treuepunkte = 0;
// API change treupunkte to 0 if kunde has 10 treuepunkte
Http.PutAsJsonAsync("https://localhost:7076/api/kunden/" + kunde.Idkunde, kunde);
}
}
protected override async Task OnInitializedAsync()
{
kunden = await Http.GetFromJsonAsync<List<Kunde>>("https://localhost:7076/api/kunden");
rabatte = await Http.GetFromJsonAsync<List<Rabatt>>("https://localhost:7076/api/Rabatte");
kunde = kunden[0];
// get the most recent rabatt, that are still valid (GueltigkeitBis)
// if there is no rabatt, set the rabatt to null
if (rabatte.Count == 0)
{
rabatt = null;
}
else
{
for (int i = 0; i < rabatte.Count; i++)
{
if (rabatte[i].GueltigkeitBis > DateTime.Now)
{
rabatt = rabatte[i];
}
}
}
//rabatt = rabatte[rabatte.Count - 1];
}
public class Kunde
{
public int Idkunde { get; set; }
public string Code { get; set; }
public int Treuepunkte { get; set; }
}
public class Rabatt
{
public int Idrabatt { get; set; }
public decimal Prozent { get; set; }
public DateTime GueltigkeitVon { get; set; }
public DateTime GueltigkeitBis { get; set; }
}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

View File

@ -11,7 +11,6 @@
border-radius: 17px; border-radius: 17px;
overflow: hidden; overflow: hidden;
border-color: #C7FFD5; border-color: #C7FFD5;
border-width: 0px;
} }
.bg_lightgreen { .bg_lightgreen {
@ -24,19 +23,19 @@
border-bottom-width: 0; border-bottom-width: 0;
} }
.btn_bg { .btn_back {
background-color: #F9BE89; background-color: #F9BE89;
/*width: 60%;*/ /*width: 60%;*/
margin-bottom: 13px; margin-bottom: 13px;
border-radius: 30px; border-radius: 30px;
/*height: 50px;*/ height: 50px;
/*border: 0px;*/ border: 0px;
} }
.btn_forward { .btn_forward {
background-color: #89F9A5; background-color: #89F9A5;
/*width: 60%;*/ /*width: 60%;*/
border-radius: 30px; border-radius: 30px;
/*height: 50px;*/ height: 50px;
/*border: 0px;*/ border: 0px;
} }

View File

@ -7,26 +7,11 @@
<ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest> <ServiceWorkerAssetsManifest>service-worker-assets.js</ServiceWorkerAssetsManifest>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<None Remove="Pages\SpeisekarteCnDetails.razor.css" />
<None Remove="Pages\SpeisekarteDrDetails.razor.css" />
<None Remove="Pages\SpeisekarteEtcDetails.razor.css" />
<None Remove="Pages\SpeisekarteJpDetails.razor.css" />
</ItemGroup>
<ItemGroup>
<Content Include="Pages\SpeisekarteCnDetails.razor.css" />
<Content Include="Pages\SpeisekarteDrDetails.razor.css" />
<Content Include="Pages\SpeisekarteEtcDetails.razor.css" />
<Content Include="Pages\SpeisekarteJpDetails.razor.css" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="wwwroot\css\Site.css" /> <None Include="wwwroot\css\Site.css" />
</ItemGroup> </ItemGroup>
<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" Version="7.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.1" PrivateAssets="all" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.1" PrivateAssets="all" />
</ItemGroup> </ItemGroup>