image änderungen

This commit is contained in:
Tizian.Breuch
2025-08-06 10:42:32 +02:00
parent 2475e896b9
commit 7ff593cfcf
16 changed files with 427 additions and 172 deletions

View File

@@ -29,6 +29,7 @@ namespace Webshop.Infrastructure.Data
public DbSet<Productcategorie> Productcategories { get; set; } = default!;
public DbSet<ProductDiscount> ProductDiscounts { get; set; } = default!;
public DbSet<CategorieDiscount> categorieDiscounts { get; set; } = default!;
public DbSet<ProductImage> ProductImages { get; set; } = default!;
protected override void OnModelCreating(ModelBuilder modelBuilder)
@@ -67,6 +68,16 @@ namespace Webshop.Infrastructure.Data
e.Property(p => p.Length).HasPrecision(18, 2);
});
modelBuilder.Entity<ProductImage>(entity =>
{
entity.ToTable("ProductImages");
entity.HasOne(pi => pi.Product)
.WithMany(p => p.Images)
.HasForeignKey(pi => pi.ProductId)
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity<ProductVariant>()
.Property(pv => pv.PriceAdjustment).HasPrecision(18, 2);