From 89be35ecb046709b9f68c318f9dcb199283f179b Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Tue, 7 Oct 2025 23:28:16 +0100 Subject: [PATCH] Fixed all relationship and write errors in all entities --- PyroFetes/Models/City.cs | 12 ++++++++++ PyroFetes/Models/Classification.cs | 4 ++-- PyroFetes/Models/Color.cs | 3 ++- PyroFetes/Models/Communication.cs | 8 ++++--- PyroFetes/Models/Contact.cs | 18 +++++++-------- PyroFetes/Models/Customer.cs | 9 +++----- PyroFetes/Models/CustomerContact.cs | 13 ----------- PyroFetes/Models/Deliverer.cs | 2 +- PyroFetes/Models/DeliveryNote.cs | 3 ++- PyroFetes/Models/Effect.cs | 4 +++- PyroFetes/Models/Movement.cs | 4 +--- PyroFetes/Models/Price.cs | 1 + PyroFetes/Models/Product.cs | 22 ++++++++++++++----- PyroFetes/Models/ProductCategory.cs | 4 ++-- PyroFetes/Models/ProductColor.cs | 4 ++-- PyroFetes/Models/ProductDelivery.cs | 3 +-- PyroFetes/Models/ProductEffect.cs | 2 +- PyroFetes/Models/ProviderContact.cs | 2 +- PyroFetes/Models/PurchaseOrder.cs | 4 +++- PyroFetes/Models/Quotation.cs | 6 +++-- .../{Provider.cs => ServiceProvider.cs} | 5 ++--- PyroFetes/Models/Show.cs | 14 +++++++----- PyroFetes/Models/ShowServiceProvider.cs | 9 ++++++++ PyroFetes/Models/Sound.cs | 6 +++-- PyroFetes/Models/SoundCategory.cs | 5 +++-- PyroFetes/Models/SoundTimecode.cs | 8 ++++--- PyroFetes/Models/Supplier.cs | 10 +++++---- PyroFetes/Models/User.cs | 8 +++---- PyroFetes/Models/Warehouse.cs | 5 +++-- PyroFetes/Models/WarehouseProduct.cs | 11 +++++----- PyroFetes/PyroFetesDbContext.cs | 19 ++-------------- 31 files changed, 124 insertions(+), 104 deletions(-) create mode 100644 PyroFetes/Models/City.cs delete mode 100644 PyroFetes/Models/CustomerContact.cs rename PyroFetes/Models/{Provider.cs => ServiceProvider.cs} (76%) create mode 100644 PyroFetes/Models/ShowServiceProvider.cs diff --git a/PyroFetes/Models/City.cs b/PyroFetes/Models/City.cs new file mode 100644 index 0000000..04dc24e --- /dev/null +++ b/PyroFetes/Models/City.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class City +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required] public int ZipCode { get; set; } + + public List? Shows { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Classification.cs b/PyroFetes/Models/Classification.cs index 6ef006b..bd3685b 100644 --- a/PyroFetes/Models/Classification.cs +++ b/PyroFetes/Models/Classification.cs @@ -5,7 +5,7 @@ namespace PyroFetes.Models; public class Classification { [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } - [Required] public List? Products { get; set; } + public List? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Color.cs b/PyroFetes/Models/Color.cs index 00bb147..acfe830 100644 --- a/PyroFetes/Models/Color.cs +++ b/PyroFetes/Models/Color.cs @@ -5,6 +5,7 @@ namespace PyroFetes.Models; public class Color { [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + public List? ProductColors { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Communication.cs b/PyroFetes/Models/Communication.cs index d7cf112..a3dd0d2 100644 --- a/PyroFetes/Models/Communication.cs +++ b/PyroFetes/Models/Communication.cs @@ -5,8 +5,10 @@ namespace PyroFetes.Models; public class Communication { [Key] public int Id { get; set; } - [Required] public string? Calling { get; set; } - [Required] public string? Email { get; set; } - [Required] public string? Meeting { get; set; } + [Required, MaxLength(100)] public string? Calling { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(300)] public string? Meeting { get; set; } + [Required] public int ContactId { get; set; } + public Contact? Contact { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Contact.cs b/PyroFetes/Models/Contact.cs index 958f52a..3644750 100644 --- a/PyroFetes/Models/Contact.cs +++ b/PyroFetes/Models/Contact.cs @@ -7,15 +7,15 @@ public class Contact [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? LastName { get; set; } [Required, MaxLength(100)] public string? FirstName { get; set; } - [Required] public string? Email { get; set; } - [Required] public string? PhoneNumber { get; set; } - [Required] public string? Address { get; set; } - [Required] public string? ZipCode { get; set; } - [Required] public string? City { get; set; } - [Required] public string? Role { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(30)] public string? PhoneNumber { get; set; } + [Required, MaxLength(100)] public string? Address { get; set; } + [Required] public int ZipCode { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + [Required, MaxLength(100)] public string? Role { get; set; } - public int CommunicationId { get; set; } - public Communication? Communication { get; set; } + public Customer? Customer { get; set; } + [Required] public int CustomerId { get; set; } - public List? CustomerContacts { get; set; } + public List? Communications { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Customer.cs b/PyroFetes/Models/Customer.cs index 98a49b0..545bca4 100644 --- a/PyroFetes/Models/Customer.cs +++ b/PyroFetes/Models/Customer.cs @@ -5,14 +5,11 @@ namespace PyroFetes.Models; public class Customer { [Key] public int Id { get; set; } - [Required] public string? Note { get; set; } + [Required, MaxLength(200)] public string? Note { get; set; } //Relations - public int CustomerTypeId { get; set; } + [Required] public int CustomerTypeId { get; set; } public CustomerType? CustomerType { get; set; } - public int ContactId { get; set; } - public Contact? Contact { get; set; } - - public List? CustomerContacts { get; set; } + public List? Contacts { get; set; } } diff --git a/PyroFetes/Models/CustomerContact.cs b/PyroFetes/Models/CustomerContact.cs deleted file mode 100644 index dff5fb2..0000000 --- a/PyroFetes/Models/CustomerContact.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.EntityFrameworkCore; - -namespace PyroFetes.Models; - -[PrimaryKey(nameof(ContactId), nameof(CustomerId))] -public class CustomerContact -{ - public int CustomerId { get; set; } - public Customer? Customer { get; set; } - public int ContactId { get; set; } - public Contact? Contact { get; set; } -} \ No newline at end of file diff --git a/PyroFetes/Models/Deliverer.cs b/PyroFetes/Models/Deliverer.cs index 2897ef9..34e708c 100644 --- a/PyroFetes/Models/Deliverer.cs +++ b/PyroFetes/Models/Deliverer.cs @@ -5,7 +5,7 @@ namespace PyroFetes.Models; public class Deliverer { [Key] public int Id { get; set; } - [Required] public string? Transporter { get; set; } + [Required, MaxLength(100)] public string? Transporter { get; set; } public List? DeliveryNotes { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/DeliveryNote.cs b/PyroFetes/Models/DeliveryNote.cs index eb7e70a..21e873e 100644 --- a/PyroFetes/Models/DeliveryNote.cs +++ b/PyroFetes/Models/DeliveryNote.cs @@ -5,11 +5,12 @@ namespace PyroFetes.Models; public class DeliveryNote { [Key] public int Id { get; set; } - [Required] public string? TrackingNumber { get; set; } + [Required, MaxLength(100)] public string? TrackingNumber { get; set; } public int DelivererId { get; set; } [Required] public DateOnly EstimateDeliveryDate { get; set; } [Required] public DateOnly ExpeditionDate { get; set; } [Required] public DateOnly RealDeliveryDate { get; set; } public Deliverer? Deliverer { get; set; } + public List? ProductDeliveries { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Effect.cs b/PyroFetes/Models/Effect.cs index 2d0ba45..0dcb87c 100644 --- a/PyroFetes/Models/Effect.cs +++ b/PyroFetes/Models/Effect.cs @@ -5,5 +5,7 @@ namespace PyroFetes.Models; public class Effect { [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } + [Required, MaxLength(200)] public string? Label { get; set; } + + public List? ProductEffects { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs index 6c53c54..b7cf0da 100644 --- a/PyroFetes/Models/Movement.cs +++ b/PyroFetes/Models/Movement.cs @@ -10,9 +10,7 @@ public class Movement [Required] public DateTime Arrival {get; set;} [Required] public int Quantity {get; set;} - [Required] public int ProductId {get; set;} - [Required] public Product? Product {get; set;} - + public List? Products { get; set; } public int? SourceWarehouseId {get; set;} public Warehouse? SourceWarehouse {get; set;} diff --git a/PyroFetes/Models/Price.cs b/PyroFetes/Models/Price.cs index 7c787bb..2ee597e 100644 --- a/PyroFetes/Models/Price.cs +++ b/PyroFetes/Models/Price.cs @@ -1,4 +1,5 @@ using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Models; diff --git a/PyroFetes/Models/Product.cs b/PyroFetes/Models/Product.cs index e7ad7ee..525195a 100644 --- a/PyroFetes/Models/Product.cs +++ b/PyroFetes/Models/Product.cs @@ -14,19 +14,29 @@ namespace PyroFetes.Models [Required] public decimal Nec { get; set; } [Required] public decimal SellingPrice { get; set; } [Required] public string? Image { get; set; } - [Required] public string? Link { get; set; } + [Required, MaxLength(200)] public string? Link { get; set; } [Required] public int MinimalQuantity { get; set; } // Relations [Required] public int ClassificationId { get; set; } - [Required] public Classification? Classification { get; set; } + public Classification? Classification { get; set; } [Required] public int ProductCategoryId { get; set; } - [Required] public ProductCategory? ProductCategory { get; set; } - - [Required] public List? Brands { get; set; } + public ProductCategory? ProductCategory { get; set; } + + [Required] public int MovementId {get; set;} + public Movement? Movement {get; set;} + + public List? ProductDeliveries { get; set; } + public List? Brands { get; set; } + public List? Movements { get; set; } + public List? ProductEffects { get; set; } + public List? ProductColors { get; set; } + public List? PurchaseProducts { get; set; } + public List? Prices { get; set; } + public List? QuotationProducts { get; set; } + public List? WarehouseProducts { get; set; } - [Required] public List? Movements { get; set; } } } \ No newline at end of file diff --git a/PyroFetes/Models/ProductCategory.cs b/PyroFetes/Models/ProductCategory.cs index 2e339ba..79bd67f 100644 --- a/PyroFetes/Models/ProductCategory.cs +++ b/PyroFetes/Models/ProductCategory.cs @@ -5,7 +5,7 @@ namespace PyroFetes.Models; public class ProductCategory { [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } - [Required] public List? Products { get; set; } + public List? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ProductColor.cs b/PyroFetes/Models/ProductColor.cs index 66acf11..f93d964 100644 --- a/PyroFetes/Models/ProductColor.cs +++ b/PyroFetes/Models/ProductColor.cs @@ -6,9 +6,9 @@ namespace PyroFetes.Models; [PrimaryKey(nameof(ProductId), nameof(ColorId))] public class ProductColor { - [Required] public Product? Product { get; set; } + public Product? Product { get; set; } [Required] public int ProductId { get; set; } - [Required] public Color? Color { get; set; } + public Color? Color { get; set; } [Required] public int ColorId { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ProductDelivery.cs b/PyroFetes/Models/ProductDelivery.cs index 1151585..bfbae68 100644 --- a/PyroFetes/Models/ProductDelivery.cs +++ b/PyroFetes/Models/ProductDelivery.cs @@ -12,5 +12,4 @@ public class ProductDelivery public Product? Product { get; set; } public DeliveryNote? DeliveryNote { get; set; } -} - \ No newline at end of file +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductEffect.cs b/PyroFetes/Models/ProductEffect.cs index 1c55e9a..3f269d6 100644 --- a/PyroFetes/Models/ProductEffect.cs +++ b/PyroFetes/Models/ProductEffect.cs @@ -9,7 +9,7 @@ public class ProductEffect [Required] public Product? Product { get; set; } [Required] public int ProductId { get; set; } - [Required] public Effect? Effect { get; set; } + public Effect? Effect { get; set; } [Required] public int EffectId { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ProviderContact.cs b/PyroFetes/Models/ProviderContact.cs index cdfefb3..8d21d35 100644 --- a/PyroFetes/Models/ProviderContact.cs +++ b/PyroFetes/Models/ProviderContact.cs @@ -6,7 +6,7 @@ namespace PyroFetes.Models; public class ProviderContact { public int ProviderId { get; set; } - public Provider? Provider { get; set; } + public ServiceProvider? Provider { get; set; } public int ContactId { get; set; } public Contact? Contact { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/PurchaseOrder.cs b/PyroFetes/Models/PurchaseOrder.cs index 3c997e9..815f5a0 100644 --- a/PyroFetes/Models/PurchaseOrder.cs +++ b/PyroFetes/Models/PurchaseOrder.cs @@ -5,5 +5,7 @@ namespace PyroFetes.Models; public class PurchaseOrder { [Key] public int Id { get; set; } - [Required] public string? PurchaseConditions { get; set; } + [Required, MaxLength(300)] public string? PurchaseConditions { get; set; } + + public List? PurchaseProducts { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Quotation.cs b/PyroFetes/Models/Quotation.cs index aadf24f..f1288ce 100644 --- a/PyroFetes/Models/Quotation.cs +++ b/PyroFetes/Models/Quotation.cs @@ -5,6 +5,8 @@ namespace PyroFetes.Models; public class Quotation { [Key] public int Id { get; set; } - [Required] public string? Message { get; set; } - [Required] public string? ConditionsSale { get; set; } + [Required, MaxLength(200)] public string? Message { get; set; } + [Required, MaxLength(300)] public string? ConditionsSale { get; set; } + + public List? QuotationProducts { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Provider.cs b/PyroFetes/Models/ServiceProvider.cs similarity index 76% rename from PyroFetes/Models/Provider.cs rename to PyroFetes/Models/ServiceProvider.cs index f48e2c3..2144b69 100644 --- a/PyroFetes/Models/Provider.cs +++ b/PyroFetes/Models/ServiceProvider.cs @@ -2,13 +2,12 @@ using System.ComponentModel.DataAnnotations; namespace PyroFetes.Models; -public class Provider +public class ServiceProvider { [Key] public int Id { get; set; } [Required] public decimal Price { get; set; } //Relations - - public int ProviderId { get; set; } + public int ProviderTypeId { get; set; } public ProviderType? ProviderType { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Show.cs b/PyroFetes/Models/Show.cs index 0713da7..29616e5 100644 --- a/PyroFetes/Models/Show.cs +++ b/PyroFetes/Models/Show.cs @@ -10,11 +10,15 @@ public class Show [MaxLength(500)] public string? Description { get; set; } // Link (path/URL/file name) to the pyrotechnic implementation plan - [Required, MaxLength(500)] - public string? PyrotechnicImplementationPlan { get; set; } - - public DateTime? Date { get; set; } + [Required, MaxLength(500)] public string? PyrotechnicImplementationPlan { get; set; } + + public DateOnly? Date { get; set; } + + [Required] public int CityId { get; set; } + public City? City { get; set; } + public ICollection? Staff { get; set; } public ICollection? Trucks { get; set; } - public ICollection? SoundCues { get; set; } + + public List? SoundTimecodes { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ShowServiceProvider.cs b/PyroFetes/Models/ShowServiceProvider.cs new file mode 100644 index 0000000..351c9fc --- /dev/null +++ b/PyroFetes/Models/ShowServiceProvider.cs @@ -0,0 +1,9 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ShowServiceProvider +{ + [Key] public int Id { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/Models/Sound.cs b/PyroFetes/Models/Sound.cs index 361d3e5..3ddee3e 100644 --- a/PyroFetes/Models/Sound.cs +++ b/PyroFetes/Models/Sound.cs @@ -12,7 +12,9 @@ public class Sound [Required, MaxLength(40)] public string? Kind { get; set; } [Required, MaxLength(40)] public string? Format { get; set; } public DateTime? CreationDate { get; set; } + [Required] public int SoundCategoryId { get; set; } - public SoundCategory? Category { get; set; } - public ICollection? ShowPlacements { get; set; } + public SoundCategory? SoundCategory { get; set; } + + public List? SoundTimecodes { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/SoundCategory.cs b/PyroFetes/Models/SoundCategory.cs index 3cabd6d..52caeaf 100644 --- a/PyroFetes/Models/SoundCategory.cs +++ b/PyroFetes/Models/SoundCategory.cs @@ -5,6 +5,7 @@ namespace PyroFetes.Models; public class SoundCategory { [Key] public int Id { get; set; } - [Required, MaxLength(60)] public string Name { get; set; } = null!; - public ICollection? Sounds { get; set; } + [Required, MaxLength(100)] public string Name { get; set; } = null!; + + public List? Sounds { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/SoundTimecode.cs b/PyroFetes/Models/SoundTimecode.cs index 7537699..3411e0c 100644 --- a/PyroFetes/Models/SoundTimecode.cs +++ b/PyroFetes/Models/SoundTimecode.cs @@ -1,14 +1,16 @@ using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; namespace PyroFetes.Models; +[PrimaryKey(nameof(ShowId), nameof(SoundId))] public class SoundTimecode { - [Key] public int Id { get; set; } [Required] public int ShowId { get; set; } public Show? Show { get; set; } [Required] public int SoundId { get; set; } public Sound? Sound { get; set; } - [Required, Range(0, int.MaxValue)] public int Start { get; set; } - [Required, Range(0, int.MaxValue)] public int End { get; set; } + + [Required] public decimal Start { get; set; } + [Required] public decimal End { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Supplier.cs b/PyroFetes/Models/Supplier.cs index 9cf8fe4..f131804 100644 --- a/PyroFetes/Models/Supplier.cs +++ b/PyroFetes/Models/Supplier.cs @@ -6,10 +6,12 @@ public class Supplier { [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? Name { get; set; } - [Required] public string? Email { get; set; } - [Required] public string? Phone { get; set; } - [Required] public string? Address { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(30)] public string? Phone { get; set; } + [Required, MaxLength(100)] public string? Address { get; set; } [Required] public int ZipCode { get; set; } - [Required] public string? City { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } [Required] public int DeliveryDelay { get; set; } + + public List? Prices { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/User.cs b/PyroFetes/Models/User.cs index a768a48..8baaa1c 100644 --- a/PyroFetes/Models/User.cs +++ b/PyroFetes/Models/User.cs @@ -6,8 +6,8 @@ public class User { [Key] public int Id { get; set; } [Required, MaxLength(100)] public string? Name { get; set; } - [Required, MinLength(12)] public string? Password { get; set; } - [Required] public string? Salt { get; set; } - [Required] public string? Email { get; set; } - [Required] public string? Fonction { get; set; } + [Required, MinLength(12), MaxLength(50)] public string? Password { get; set; } + [Required, MaxLength(100)] public string? Salt { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(100)] public string? Fonction { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Warehouse.cs b/PyroFetes/Models/Warehouse.cs index 3dd817f..4a69d2d 100644 --- a/PyroFetes/Models/Warehouse.cs +++ b/PyroFetes/Models/Warehouse.cs @@ -9,10 +9,11 @@ public class Warehouse [Required] public int MaxWeight {get; set;} [Required] public int Current {get; set;} [Required] public int MinWeight {get; set;} - [Required] public string? Address { get; set; } + [Required, MaxLength(100)] public string? Address { get; set; } [Required] public int ZipCode { get; set; } - [Required] public string? City { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + public List? WarehouseProducts { get; set; } public List? Materials {get; set;} public List? MovementsSource { get; set; } public List? MovementsDestination { get; set; } diff --git a/PyroFetes/Models/WarehouseProduct.cs b/PyroFetes/Models/WarehouseProduct.cs index ca3716c..fe89d36 100644 --- a/PyroFetes/Models/WarehouseProduct.cs +++ b/PyroFetes/Models/WarehouseProduct.cs @@ -1,14 +1,15 @@ using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; namespace PyroFetes.Models; +[PrimaryKey(nameof(ProductId), nameof(WarehouseId))] public class WarehouseProduct { - [Key] public int Quantity { get; set; } - [Required] public int ProductId { get; set; } - [Required] public Product? Product { get; set; } - + public Product? Product { get; set; } [Required] public int WarehouseId { get; set; } - [Required] public Warehouse? Warehouse { get; set; } + public Warehouse? Warehouse { get; set; } + + [Required] public int Quantity { get; set; } } \ No newline at end of file diff --git a/PyroFetes/PyroFetesDbContext.cs b/PyroFetes/PyroFetesDbContext.cs index d71044c..9c25dd8 100644 --- a/PyroFetes/PyroFetesDbContext.cs +++ b/PyroFetes/PyroFetesDbContext.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using PyroFetes.Models; +using ServiceProvider = PyroFetes.Models.ServiceProvider; namespace PyroFetes; @@ -13,7 +14,6 @@ public class PyroFetesDbContext : DbContext public DbSet Communications { get; set; } public DbSet Contacts { get; set; } public DbSet Customers { get; set; } - public DbSet CustomerContacts { get; set; } public DbSet CustomerTypes { get; set; } public DbSet Deliverers { get; set; } public DbSet DeliveryNotes { get; set; } @@ -28,7 +28,7 @@ public class PyroFetesDbContext : DbContext public DbSet ProductColors { get; set; } public DbSet ProductDeliveries { get; set; } public DbSet ProductEffects { get; set; } - public DbSet Providers { get; set; } + public DbSet Providers { get; set; } public DbSet ProviderContacts { get; set; } public DbSet ProviderTypes { get; set; } public DbSet PurchaseOrders { get; set; } @@ -77,20 +77,5 @@ public class PyroFetesDbContext : DbContext .WithMany(w => w.MovementsDestination) .HasForeignKey(m => m.DestinationWarehouseId) .OnDelete(DeleteBehavior.Restrict); - - modelBuilder.Entity() - .HasKey(cc => new { cc.ContactId, cc.CustomerId }); - - modelBuilder.Entity() - .HasOne(cc => cc.Customer) - .WithMany(c => c.CustomerContacts) - .HasForeignKey(cc => cc.CustomerId) - .OnDelete(DeleteBehavior.NoAction); - - modelBuilder.Entity() - .HasOne(cc => cc.Contact) - .WithMany(c => c.CustomerContacts) - .HasForeignKey(cc => cc.ContactId) - .OnDelete(DeleteBehavior.NoAction); } } \ No newline at end of file