Flasche um Bild und Alkoholisch-Bool ergänzt

Glas-Tabelle hinzugefügt
This commit is contained in:
BuildTools committed 2024-02-07 19:54:06 +01:00
1 parent 7fcd0c3247
commit b0bebbec8c
10 files changed
+381 -2

No files matched your search

+6 -2
View File
@@ -11,6 +11,8 @@ namespace CocktailWeb.Data
public DbSet<Cocktail> Cocktails { get; set; }
public DbSet<Filler> Fillers { get; set; }
public DbSet<Glas> Glaeser { get; set; }
public DbDataContext(IConfiguration configuration)
{
_configuration = configuration;
@@ -25,8 +27,8 @@ namespace CocktailWeb.Data
{
modelBuilder.Entity<Flasche>().ToTable("Flaschen");
modelBuilder.Entity<Flasche>().HasData(
new Flasche("Jägermeister") { Id = 1 },
new Flasche("Wodka") { Id = 2 }
new Flasche("Jägermeister") { Id = 1, Alkoholisch = true },
new Flasche("Wodka") { Id = 2, Alkoholisch = true }
);
modelBuilder.Entity<Filler>().HasData(
@@ -46,6 +48,8 @@ namespace CocktailWeb.Data
new Filler() { Id = 14, Pos = 14, Type = Filler.FillerType.Pump }
);
modelBuilder.Entity<Glas>().ToTable("Glaeser");
// modelBuilder.Entity<Cocktail>().HasMany(c => c.CocktailFlaschen).WithOne(c => c.Cocktail).HasForeignKey(c => c.CocktailID);
+2
View File
@@ -4,6 +4,8 @@
{
public int Id { get; set; }
public string Name { get; set; } = "";
public bool Alkoholisch { get; set; }
public string? ImageURL { get; set; }
public Flasche()
{
+15
View File
@@ -0,0 +1,15 @@
namespace CocktailWeb.Data
{
public class Glas
{
public int Id { get; set; }
public string Name { get
{
return $"{Fuellmenge} ml";
}
}
public int Fuellmenge { get; set; }
public string? ImageURL { get; set; }
}
}
Binary file not shown.