update
This commit is contained in:
@@ -55,7 +55,8 @@ namespace Webshop.Infrastructure.Data
|
||||
modelBuilder.Entity<Setting>().HasIndex(s => s.Key).IsUnique();
|
||||
modelBuilder.Entity<Order>().HasIndex(o => o.OrderNumber).IsUnique();
|
||||
|
||||
modelBuilder.Entity<Product>(e => {
|
||||
modelBuilder.Entity<Product>(e =>
|
||||
{
|
||||
e.Property(p => p.Price).HasPrecision(18, 2);
|
||||
e.Property(p => p.OldPrice).HasPrecision(18, 2);
|
||||
e.Property(p => p.PurchasePrice).HasPrecision(18, 2);
|
||||
@@ -68,24 +69,28 @@ namespace Webshop.Infrastructure.Data
|
||||
modelBuilder.Entity<ProductVariant>()
|
||||
.Property(pv => pv.PriceAdjustment).HasPrecision(18, 2);
|
||||
|
||||
modelBuilder.Entity<Order>(e => {
|
||||
modelBuilder.Entity<Order>(e =>
|
||||
{
|
||||
e.Property(o => o.OrderTotal).HasPrecision(18, 2);
|
||||
e.Property(o => o.ShippingCost).HasPrecision(18, 2);
|
||||
e.Property(o => o.TaxAmount).HasPrecision(18, 2);
|
||||
e.Property(o => o.DiscountAmount).HasPrecision(18, 2);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<OrderItem>(e => {
|
||||
modelBuilder.Entity<OrderItem>(e =>
|
||||
{
|
||||
e.Property(oi => oi.UnitPrice).HasPrecision(18, 2);
|
||||
e.Property(oi => oi.TotalPrice).HasPrecision(18, 2);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Discount>(e => {
|
||||
modelBuilder.Entity<Discount>(e =>
|
||||
{
|
||||
e.Property(d => d.DiscountValue).HasPrecision(18, 2);
|
||||
e.Property(d => d.MinimumOrderAmount).HasPrecision(18, 2);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ShippingMethod>(e => {
|
||||
modelBuilder.Entity<ShippingMethod>(e =>
|
||||
{
|
||||
e.Property(sm => sm.BaseCost).HasPrecision(18, 2);
|
||||
e.Property(sm => sm.MinimumOrderAmount).HasPrecision(18, 2);
|
||||
});
|
||||
@@ -122,6 +127,11 @@ namespace Webshop.Infrastructure.Data
|
||||
.WithMany()
|
||||
.HasForeignKey(o => o.ShippingAddressId)
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
modelBuilder.Entity<ApplicationUser>()
|
||||
.HasOne(a => a.Customer) // Ein ApplicationUser hat ein optionales Customer-Profil
|
||||
.WithOne(c => c.User) // Ein Customer-Profil ist mit genau einem User verknüpft
|
||||
.HasForeignKey<Customer>(c => c.AspNetUserId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user