Filler-Tabelle hinzugefügt

This commit is contained in:
BuildTools committed 2024-02-05 17:58:14 +01:00
1 parent e94064cff2
commit 531c833e76
7 files changed
+724 -4

No files matched your search

+18
View File
@@ -9,6 +9,8 @@ namespace CocktailWeb.Data
public DbSet<Flasche> Flaschen { get; set; }
public DbSet<CocktailFlasche> CocktailFlaschen { get; set; }
public DbSet<Cocktail> Cocktails { get; set; }
public DbSet<Filler> Fillers { get; set; }
public DbDataContext(IConfiguration configuration)
{
_configuration = configuration;
@@ -27,6 +29,22 @@ namespace CocktailWeb.Data
new Flasche("Wodka") { Id = 2 }
);
modelBuilder.Entity<Filler>().HasData(
new Filler() { Id = 1, Pos = 1, Type = Filler.FillerType.Pump },
new Filler() { Id = 2, Pos = 2, Type = Filler.FillerType.Pump },
new Filler() { Id = 3, Pos = 3, Type = Filler.FillerType.Pump },
new Filler() { Id = 4, Pos = 4, Type = Filler.FillerType.Pourer },
new Filler() { Id = 5, Pos = 5, Type = Filler.FillerType.Pourer },
new Filler() { Id = 6, Pos = 6, Type = Filler.FillerType.Pourer },
new Filler() { Id = 7, Pos = 7, Type = Filler.FillerType.Pourer },
new Filler() { Id = 8, Pos = 8, Type = Filler.FillerType.Pourer },
new Filler() { Id = 9, Pos = 9, Type = Filler.FillerType.Pourer },
new Filler() { Id = 10, Pos = 10, Type = Filler.FillerType.Pourer },
new Filler() { Id = 11, Pos = 11, Type = Filler.FillerType.Pourer },
new Filler() { Id = 12, Pos = 12, Type = Filler.FillerType.Pump },
new Filler() { Id = 13, Pos = 13, Type = Filler.FillerType.Pump },
new Filler() { Id = 14, Pos = 14, Type = Filler.FillerType.Pump }
);
// modelBuilder.Entity<Cocktail>().HasMany(c => c.CocktailFlaschen).WithOne(c => c.Cocktail).HasForeignKey(c => c.CocktailID);
+17
View File
@@ -0,0 +1,17 @@
namespace CocktailWeb.Data
{
public class Filler
{
public int Id { get; set; }
public int Pos { get; set; }
public FillerType Type { get; set; }
public Flasche? Flasche { get; set; }
public enum FillerType
{
Pump,
Pourer
}
}
}