mirror of
https://github.com/yummy4friends/y4f.git
synced 2025-01-30 00:34:45 +01:00
Add db integration show menuitems
This commit is contained in:
parent
9cd1376cfd
commit
a51fe08db8
2
.gitignore
vendored
2
.gitignore
vendored
@ -136,3 +136,5 @@ $RECYCLE.BIN/
|
||||
.DS_Store
|
||||
|
||||
_NCrunch*
|
||||
/src/WebApi/appsettings.json
|
||||
/src/WebApi/appsettings.json
|
||||
|
138
src/WebApi/Controllers/MenuitemHasAllergiesController.cs
Normal file
138
src/WebApi/Controllers/MenuitemHasAllergiesController.cs
Normal file
@ -0,0 +1,138 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
@ -7,224 +7,260 @@ namespace WebApi.Data;
|
||||
|
||||
public partial class WebApiContext : DbContext
|
||||
{
|
||||
public WebApiContext(DbContextOptions<WebApiContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
public WebApiContext(DbContextOptions<WebApiContext> 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; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder
|
||||
.UseCollation("utf8_general_ci")
|
||||
.HasCharSet("utf8");
|
||||
|
||||
modelBuilder.Entity<Allergie>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Idallergie).HasName("PRIMARY");
|
||||
modelBuilder.Entity<Allergie>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Idallergie).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("allergie");
|
||||
entity.ToTable("allergie");
|
||||
|
||||
entity.Property(e => e.Idallergie)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDAllergie");
|
||||
entity.Property(e => e.Beschreibung).HasMaxLength(45);
|
||||
});
|
||||
entity.Property(e => e.Idallergie)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDAllergie");
|
||||
entity.Property(e => e.Beschreibung).HasMaxLength(45);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Bestellungsposition>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Idbestellung).HasName("PRIMARY");
|
||||
modelBuilder.Entity<Bestellungsposition>(entity =>
|
||||
{
|
||||
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)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDBestellung");
|
||||
entity.Property(e => e.Datum).HasColumnType("datetime");
|
||||
entity.Property(e => e.KundeIdkunde)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("Kunde_IDKunde");
|
||||
entity.Property(e => e.Menge).HasColumnType("int(11)");
|
||||
entity.Property(e => e.RabattIdrabatt)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("Rabatt_IDRabatt");
|
||||
entity.Property(e => e.Idbestellung)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDBestellung");
|
||||
entity.Property(e => e.Datum).HasColumnType("datetime");
|
||||
entity.Property(e => e.KundeIdkunde)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("Kunde_IDKunde");
|
||||
entity.Property(e => e.Menge).HasColumnType("int(11)");
|
||||
entity.Property(e => e.RabattIdrabatt)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("Rabatt_IDRabatt");
|
||||
|
||||
entity.HasOne(d => d.KundeIdkundeNavigation).WithMany(p => p.Bestellungspositions)
|
||||
.HasForeignKey(d => d.KundeIdkunde)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellung_Kunde");
|
||||
entity.HasOne(d => d.KundeIdkundeNavigation).WithMany(p => p.Bestellungspositions)
|
||||
.HasForeignKey(d => d.KundeIdkunde)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellung_Kunde");
|
||||
|
||||
entity.HasOne(d => d.RabattIdrabattNavigation).WithMany(p => p.Bestellungspositions)
|
||||
.HasForeignKey(d => d.RabattIdrabatt)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_Rabatt1");
|
||||
entity.HasOne(d => d.RabattIdrabattNavigation).WithMany(p => p.Bestellungspositions)
|
||||
.HasForeignKey(d => d.RabattIdrabatt)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_Rabatt1");
|
||||
|
||||
entity.HasMany(d => d.MenuItemIdmenuItems).WithMany(p => p.BestellungspositionIdbestellungs)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"BestellungspositionHasMenuitem",
|
||||
r => r.HasOne<Menuitem>().WithMany()
|
||||
.HasForeignKey("MenuItemIdmenuItem")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_MenuItem1"),
|
||||
l => l.HasOne<Bestellungsposition>().WithMany()
|
||||
.HasForeignKey("BestellungspositionIdbestellung")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_Bestellungsposition1"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("BestellungspositionIdbestellung", "MenuItemIdmenuItem")
|
||||
.HasName("PRIMARY")
|
||||
.HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
|
||||
j.ToTable("bestellungsposition_has_menuitem");
|
||||
j.HasIndex(new[] { "MenuItemIdmenuItem" }, "fk_Bestellungsposition_has_MenuItem_MenuItem1");
|
||||
j.IndexerProperty<int>("BestellungspositionIdbestellung")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("Bestellungsposition_IDBestellung");
|
||||
j.IndexerProperty<int>("MenuItemIdmenuItem")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("MenuItem_IDMenuItem");
|
||||
});
|
||||
});
|
||||
entity.HasMany(d => d.MenuItemIdmenuItems).WithMany(p => p.BestellungspositionIdbestellungs)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"BestellungspositionHasMenuitem",
|
||||
r => r.HasOne<Menuitem>().WithMany()
|
||||
.HasForeignKey("MenuItemIdmenuItem")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_MenuItem1"),
|
||||
l => l.HasOne<Bestellungsposition>().WithMany()
|
||||
.HasForeignKey("BestellungspositionIdbestellung")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_Bestellungsposition_has_MenuItem_Bestellungsposition1"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("BestellungspositionIdbestellung", "MenuItemIdmenuItem")
|
||||
.HasName("PRIMARY")
|
||||
.HasAnnotation("MySql:IndexPrefixLength", new[] { 0, 0 });
|
||||
j.ToTable("bestellungsposition_has_menuitem");
|
||||
j.HasIndex(new[] { "MenuItemIdmenuItem" }, "fk_Bestellungsposition_has_MenuItem_MenuItem1");
|
||||
j.IndexerProperty<int>("BestellungspositionIdbestellung")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("Bestellungsposition_IDBestellung");
|
||||
j.IndexerProperty<int>("MenuItemIdmenuItem")
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("MenuItem_IDMenuItem");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Kunde>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Idkunde).HasName("PRIMARY");
|
||||
modelBuilder.Entity<Kunde>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Idkunde).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("kunde");
|
||||
entity.ToTable("kunde");
|
||||
|
||||
entity.Property(e => e.Idkunde)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDKunde");
|
||||
entity.Property(e => e.Code)
|
||||
.HasMaxLength(45)
|
||||
.HasColumnName("code");
|
||||
entity.Property(e => e.Treuepunkte).HasColumnType("int(11)");
|
||||
});
|
||||
entity.Property(e => e.Idkunde)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDKunde");
|
||||
entity.Property(e => e.Code)
|
||||
.HasMaxLength(45)
|
||||
.HasColumnName("code");
|
||||
entity.Property(e => e.Treuepunkte).HasColumnType("int(11)");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Menuitem>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdmenuItem).HasName("PRIMARY");
|
||||
modelBuilder.Entity<Menuitem>(entity =>
|
||||
{
|
||||
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)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDMenuItem");
|
||||
entity.Property(e => e.Bezeichnung).HasMaxLength(45);
|
||||
entity.Property(e => e.MenuItemKategorieIdmenuItemKategorie)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("MenuItemKategorie_IDMenuItemKategorie");
|
||||
entity.Property(e => e.Preis).HasPrecision(8, 2);
|
||||
entity.Property(e => e.Zusatzinformation).HasMaxLength(45);
|
||||
entity.Property(e => e.IdmenuItem)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDMenuItem");
|
||||
entity.Property(e => e.Bezeichnung).HasMaxLength(45);
|
||||
entity.Property(e => e.MenuItemKategorieIdmenuItemKategorie)
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("MenuItemKategorie_IDMenuItemKategorie");
|
||||
entity.Property(e => e.Preis).HasPrecision(8, 2);
|
||||
entity.Property(e => e.Zusatzinformation).HasMaxLength(45);
|
||||
|
||||
entity.HasOne(d => d.MenuItemKategorieIdmenuItemKategorieNavigation).WithMany(p => p.Menuitems)
|
||||
.HasForeignKey(d => d.MenuItemKategorieIdmenuItemKategorie)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_MenuItem_MenuItemKategorie1");
|
||||
entity.HasOne(d => d.MenuItemKategorieIdmenuItemKategorieNavigation).WithMany(p => p.Menuitems)
|
||||
.HasForeignKey(d => d.MenuItemKategorieIdmenuItemKategorie)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_MenuItem_MenuItemKategorie1");
|
||||
|
||||
entity.HasMany(d => d.AllergieIdallergies).WithMany(p => p.MenuItemIdmenuItems)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"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.HasMany(d => d.AllergieIdallergies).WithMany(p => p.MenuItemIdmenuItems)
|
||||
// .UsingEntity<Dictionary<string, object>>(
|
||||
// "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");
|
||||
// });
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Menuitemkategorie>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdmenuItemKategorie).HasName("PRIMARY");
|
||||
modelBuilder.Entity<Menuitemkategorie>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdmenuItemKategorie).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("menuitemkategorie");
|
||||
entity.ToTable("menuitemkategorie");
|
||||
|
||||
entity.HasIndex(e => e.MenuItemUeberkategorieIdmenuItemUeberkategorie, "fk_MenuItemKategorie_MenuItemUeberkategorie1");
|
||||
entity.HasIndex(e => e.MenuItemUeberkategorieIdmenuItemUeberkategorie, "fk_MenuItemKategorie_MenuItemUeberkategorie1");
|
||||
|
||||
entity.Property(e => e.IdmenuItemKategorie)
|
||||
.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.Property(e => e.IdmenuItemKategorie)
|
||||
.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)
|
||||
.HasForeignKey(d => d.MenuItemUeberkategorieIdmenuItemUeberkategorie)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_MenuItemKategorie_MenuItemUeberkategorie1");
|
||||
});
|
||||
entity.HasOne(d => d.MenuItemUeberkategorieIdmenuItemUeberkategorieNavigation).WithMany(p => p.Menuitemkategories)
|
||||
.HasForeignKey(d => d.MenuItemUeberkategorieIdmenuItemUeberkategorie)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_MenuItemKategorie_MenuItemUeberkategorie1");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Menuitemueberkategorie>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdmenuItemUeberkategorie).HasName("PRIMARY");
|
||||
modelBuilder.Entity<Menuitemueberkategorie>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdmenuItemUeberkategorie).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("menuitemueberkategorie");
|
||||
entity.ToTable("menuitemueberkategorie");
|
||||
|
||||
entity.Property(e => e.IdmenuItemUeberkategorie)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDMenuItemUeberkategorie");
|
||||
entity.Property(e => e.Bezeichnung).HasMaxLength(45);
|
||||
});
|
||||
entity.Property(e => e.IdmenuItemUeberkategorie)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnType("int(11)")
|
||||
.HasColumnName("IDMenuItemUeberkategorie");
|
||||
entity.Property(e => e.Bezeichnung).HasMaxLength(45);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Rabatt>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Idrabatt).HasName("PRIMARY");
|
||||
modelBuilder.Entity<Rabatt>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Idrabatt).HasName("PRIMARY");
|
||||
|
||||
entity.ToTable("rabatt");
|
||||
entity.ToTable("rabatt");
|
||||
|
||||
entity.Property(e => e.Idrabatt)
|
||||
.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);
|
||||
});
|
||||
entity.Property(e => e.Idrabatt)
|
||||
.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);
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
//modelBuilder.Entity<Admin>(entity =>
|
||||
//{
|
||||
// entity.HasKey(e => e.Id).HasName("PRIMARY");
|
||||
// entity.ToTable("admin");
|
||||
// entity.Property(e => e.Id)
|
||||
// .ValueGeneratedNever()
|
||||
// .HasColumnType("int(11)")
|
||||
// .HasColumnName("Id");
|
||||
// entity.Property(e => e.Username).HasMaxLength(100);
|
||||
// entity.Property(e => e.Password).HasMaxLength(100);
|
||||
//});
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
//modelBuilder.Entity<BestellungspositionHasMenuitem>(entity =>
|
||||
//{
|
||||
// entity.HasKey(e => new { e.BestellungspositionId, e.MenuitemId })
|
||||
// .HasName("PRIMARY");
|
||||
|
||||
// entity.ToTable("bestellungsposition_has_menuitem");
|
||||
|
||||
// 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);
|
||||
|
||||
public DbSet<WebApi.Models.MenuitemHasAllergie> MenuitemHasAllergie { get; set; } = default!;
|
||||
}
|
||||
|
11
src/WebApi/Models/MenuitemHasAllergie.cs
Normal file
11
src/WebApi/Models/MenuitemHasAllergie.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace WebApi.Models
|
||||
{
|
||||
public class MenuitemHasAllergie
|
||||
{
|
||||
// navigation references Menuitem
|
||||
public int? MenuItem_IDMenuItem { get; set; }
|
||||
|
||||
// navigation references Allergie
|
||||
public int? Allergie_IDAllergie { get; set; }
|
||||
}
|
||||
}
|
@ -7,18 +7,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.8" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.8">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.6" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.7" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="7.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"Y4FDB": "Server=localhost;Database=y4f;Uid=user;Pwd=user"
|
||||
}
|
||||
}
|
@ -3,11 +3,9 @@
|
||||
@inject HttpClient Http
|
||||
|
||||
<h1>Speisekarte Chinesisch</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">Chinesisch</button>
|
||||
<button type="button" class="btn">Nudel</button>
|
||||
@ -15,45 +13,39 @@
|
||||
<button type="button" class="btn">Nachspeise</button>
|
||||
</div>
|
||||
|
||||
@* create an bootstrap card for each speise*@
|
||||
@*make card round with border*@
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Nudeln mit Hühnerfleisch (A, E)</h5>
|
||||
<p class="card-text">Huhn, Gemüse</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Knusprige Ente auf Nudeln (A, D)</h5>
|
||||
<p class="card-text">Ente</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3 ">
|
||||
<div class="card-body">
|
||||
@*create two divs columns*@
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<h5 class="card-title">Nudeln mit Tofu (D, F)</h5>
|
||||
<p class="card-text">Tofu</p>
|
||||
</div>
|
||||
@*div text center*@
|
||||
<div class="col-4 d-flex justify-content-center align-items-center">
|
||||
<div style="font-size:15pt;">10,00€</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</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 ">
|
||||
<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*@
|
||||
@ -76,9 +68,6 @@
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -87,6 +76,122 @@
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
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>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -14,44 +14,42 @@
|
||||
<button type="button" class="btn">Bier</button>
|
||||
</div>
|
||||
|
||||
@* create an bootstrap card for each speise*@
|
||||
@*make card round with border*@
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Nudeln mit Hühnerfleisch (A, E)</h5>
|
||||
<p class="card-text">Huhn, Gemüse</p>
|
||||
</div>
|
||||
</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">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Knusprige Ente auf Nudeln (A, D)</h5>
|
||||
<p class="card-text">Ente</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mt-3 ">
|
||||
<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 class="card mt-3 ">
|
||||
<div class="card-body">
|
||||
@*create two divs columns*@
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<h5 class="card-title">Nudeln mit Tofu (D, F)</h5>
|
||||
<p class="card-text">Tofu</p>
|
||||
</div>
|
||||
@*div text center*@
|
||||
<div class="col-4 d-flex justify-content-center align-items-center">
|
||||
<div style="font-size:15pt;">10,00€</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@ -85,7 +83,122 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
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>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -16,44 +16,40 @@
|
||||
<button type="button" class="btn">Vorspeisen</button>
|
||||
</div>
|
||||
|
||||
@* create an bootstrap card for each speise*@
|
||||
@*make card round with border*@
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Nudeln mit Hühnerfleisch (A, E)</h5>
|
||||
<p class="card-text">Huhn, Gemüse</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Knusprige Ente auf Nudeln (A, D)</h5>
|
||||
<p class="card-text">Ente</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3 ">
|
||||
<div class="card-body">
|
||||
@*create two divs columns*@
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<h5 class="card-title">Nudeln mit Tofu (D, F)</h5>
|
||||
<p class="card-text">Tofu</p>
|
||||
</div>
|
||||
@*div text center*@
|
||||
<div class="col-4 d-flex justify-content-center align-items-center">
|
||||
<div style="font-size:15pt;">10,00€</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</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 ">
|
||||
<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">
|
||||
@ -90,4 +86,114 @@
|
||||
|
||||
|
||||
@code {
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
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>();
|
||||
}
|
||||
}
|
@ -15,44 +15,43 @@
|
||||
<button type="button" class="btn">Nachspeise</button>
|
||||
</div>
|
||||
|
||||
@* create an bootstrap card for each speise*@
|
||||
@*make card round with border*@
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Nudeln mit Hühnerfleisch (A, E)</h5>
|
||||
<p class="card-text">Huhn, Gemüse</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Knusprige Ente auf Nudeln (A, D)</h5>
|
||||
<p class="card-text">Ente</p>
|
||||
</div>
|
||||
</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 ">
|
||||
<div class="card-body">
|
||||
@*create two divs columns*@
|
||||
<div class="row">
|
||||
<div class="col-8">
|
||||
<h5 class="card-title">Nudeln mit Tofu (D, F)</h5>
|
||||
<p class="card-text">Tofu</p>
|
||||
</div>
|
||||
@*div text center*@
|
||||
<div class="col-4 d-flex justify-content-center align-items-center">
|
||||
<div style="font-size:15pt;">10,00€</div>
|
||||
</div>
|
||||
<div class="card mt-3 ">
|
||||
<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>
|
||||
</div>
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@ -86,7 +85,122 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@code {
|
||||
}
|
||||
// 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()
|
||||
{
|
||||
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>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user