diff --git a/ComputerStoreDatabaseImplement/Migrations/20230517185025_RelationFixesV2.Designer.cs b/ComputerStoreDatabaseImplement/Migrations/20230517185025_RelationFixesV2.Designer.cs
new file mode 100644
index 0000000..21ee431
--- /dev/null
+++ b/ComputerStoreDatabaseImplement/Migrations/20230517185025_RelationFixesV2.Designer.cs
@@ -0,0 +1,499 @@
+//
+using System;
+using ComputerStoreDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace ComputerStoreDatabaseImplement.Migrations
+{
+ [DbContext(typeof(ComputerStoreDatabase))]
+ [Migration("20230517185025_RelationFixesV2")]
+ partial class RelationFixesV2
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Component", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.ToTable("Components");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("OrderID");
+
+ b.HasIndex("ProductID");
+
+ b.ToTable("Consignments");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ConsignmentProduct", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ConsignmentID")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ConsignmentID");
+
+ b.HasIndex("ProductID");
+
+ b.ToTable("ConsignmentProducts");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Employee", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("FirstName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MiddleName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Employees");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("SellerID")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("SellerID");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("EmployeeID")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("RequestID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("EmployeeID");
+
+ b.ToTable("PCs");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("EmployeeID")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("EmployeeID");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ProductComponent", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ComponentID")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ComponentID");
+
+ b.HasIndex("ProductID");
+
+ b.ToTable("ProductComponents");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("PCID")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("OrderID");
+
+ b.ToTable("Requests");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.RequestComponent", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ComponentID")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("PCID")
+ .IsRequired()
+ .HasColumnType("int");
+
+ b.Property("RequestID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ComponentID");
+
+ b.HasIndex("PCID");
+
+ b.HasIndex("RequestID");
+
+ b.ToTable("RequestComponents");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Seller", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("FirstName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MiddleName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Sellers");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Order", "Order")
+ .WithMany("_consignments")
+ .HasForeignKey("OrderID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Product", null)
+ .WithMany("Consignments")
+ .HasForeignKey("ProductID");
+
+ b.Navigation("Order");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ConsignmentProduct", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Consignment", "Consignment")
+ .WithMany("Products")
+ .HasForeignKey("ConsignmentID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Product", "Product")
+ .WithMany()
+ .HasForeignKey("ProductID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Consignment");
+
+ b.Navigation("Product");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Seller", "Seller")
+ .WithMany("Orders")
+ .HasForeignKey("SellerID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Seller");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Employee", "Employee")
+ .WithMany("PCs")
+ .HasForeignKey("EmployeeID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Employee");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Employee", "Employee")
+ .WithMany("Products")
+ .HasForeignKey("EmployeeID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Employee");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ProductComponent", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Component", "Component")
+ .WithMany("ConsignmentComponents")
+ .HasForeignKey("ComponentID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Product", "Product")
+ .WithMany("Components")
+ .HasForeignKey("ProductID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Component");
+
+ b.Navigation("Product");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Order", "Order")
+ .WithMany("_requests")
+ .HasForeignKey("OrderID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Order");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.RequestComponent", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Component", "Component")
+ .WithMany("RequestComponents")
+ .HasForeignKey("ComponentID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.PC", "PC")
+ .WithMany("Components")
+ .HasForeignKey("PCID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Request", "Request")
+ .WithMany("PCs")
+ .HasForeignKey("RequestID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Component");
+
+ b.Navigation("PC");
+
+ b.Navigation("Request");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Component", b =>
+ {
+ b.Navigation("ConsignmentComponents");
+
+ b.Navigation("RequestComponents");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
+ {
+ b.Navigation("Products");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Employee", b =>
+ {
+ b.Navigation("PCs");
+
+ b.Navigation("Products");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
+ {
+ b.Navigation("_consignments");
+
+ b.Navigation("_requests");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
+ {
+ b.Navigation("Components");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Consignments");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
+ {
+ b.Navigation("PCs");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Seller", b =>
+ {
+ b.Navigation("Orders");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/ComputerStoreDatabaseImplement/Migrations/20230517185025_RelationFixesV2.cs b/ComputerStoreDatabaseImplement/Migrations/20230517185025_RelationFixesV2.cs
new file mode 100644
index 0000000..d5c4f95
--- /dev/null
+++ b/ComputerStoreDatabaseImplement/Migrations/20230517185025_RelationFixesV2.cs
@@ -0,0 +1,59 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ComputerStoreDatabaseImplement.Migrations
+{
+ ///
+ public partial class RelationFixesV2 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_RequestComponents_PCs_PCID",
+ table: "RequestComponents");
+
+ migrationBuilder.AlterColumn(
+ name: "PCID",
+ table: "RequestComponents",
+ type: "int",
+ nullable: false,
+ defaultValue: 0,
+ oldClrType: typeof(int),
+ oldType: "int",
+ oldNullable: true);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_RequestComponents_PCs_PCID",
+ table: "RequestComponents",
+ column: "PCID",
+ principalTable: "PCs",
+ principalColumn: "ID",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_RequestComponents_PCs_PCID",
+ table: "RequestComponents");
+
+ migrationBuilder.AlterColumn(
+ name: "PCID",
+ table: "RequestComponents",
+ type: "int",
+ nullable: true,
+ oldClrType: typeof(int),
+ oldType: "int");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_RequestComponents_PCs_PCID",
+ table: "RequestComponents",
+ column: "PCID",
+ principalTable: "PCs",
+ principalColumn: "ID");
+ }
+ }
+}
diff --git a/ComputerStoreDatabaseImplement/Migrations/20230517185727_RelationFixesV3.Designer.cs b/ComputerStoreDatabaseImplement/Migrations/20230517185727_RelationFixesV3.Designer.cs
new file mode 100644
index 0000000..0b67f1f
--- /dev/null
+++ b/ComputerStoreDatabaseImplement/Migrations/20230517185727_RelationFixesV3.Designer.cs
@@ -0,0 +1,498 @@
+//
+using System;
+using ComputerStoreDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace ComputerStoreDatabaseImplement.Migrations
+{
+ [DbContext(typeof(ComputerStoreDatabase))]
+ [Migration("20230517185727_RelationFixesV3")]
+ partial class RelationFixesV3
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Component", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.ToTable("Components");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("OrderID");
+
+ b.HasIndex("ProductID");
+
+ b.ToTable("Consignments");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ConsignmentProduct", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ConsignmentID")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ConsignmentID");
+
+ b.HasIndex("ProductID");
+
+ b.ToTable("ConsignmentProducts");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Employee", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("FirstName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MiddleName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Employees");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("SellerID")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("SellerID");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("EmployeeID")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("RequestID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("EmployeeID");
+
+ b.ToTable("PCs");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("EmployeeID")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("EmployeeID");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ProductComponent", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ComponentID")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ComponentID");
+
+ b.HasIndex("ProductID");
+
+ b.ToTable("ProductComponents");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("PCID")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("OrderID");
+
+ b.ToTable("Requests");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.RequestComponent", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("ComponentID")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("PCID")
+ .HasColumnType("int");
+
+ b.Property("RequestID")
+ .HasColumnType("int");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ComponentID");
+
+ b.HasIndex("PCID");
+
+ b.HasIndex("RequestID");
+
+ b.ToTable("RequestComponents");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Seller", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("FirstName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("LastName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("MiddleName")
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Sellers");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Order", "Order")
+ .WithMany("_consignments")
+ .HasForeignKey("OrderID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Product", null)
+ .WithMany("Consignments")
+ .HasForeignKey("ProductID");
+
+ b.Navigation("Order");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ConsignmentProduct", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Consignment", "Consignment")
+ .WithMany("Products")
+ .HasForeignKey("ConsignmentID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Product", "Product")
+ .WithMany()
+ .HasForeignKey("ProductID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Consignment");
+
+ b.Navigation("Product");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Seller", "Seller")
+ .WithMany("Orders")
+ .HasForeignKey("SellerID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Seller");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Employee", "Employee")
+ .WithMany("PCs")
+ .HasForeignKey("EmployeeID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Employee");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Employee", "Employee")
+ .WithMany("Products")
+ .HasForeignKey("EmployeeID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Employee");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.ProductComponent", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Component", "Component")
+ .WithMany("ConsignmentComponents")
+ .HasForeignKey("ComponentID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Product", "Product")
+ .WithMany("Components")
+ .HasForeignKey("ProductID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Component");
+
+ b.Navigation("Product");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Order", "Order")
+ .WithMany("_requests")
+ .HasForeignKey("OrderID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Order");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.RequestComponent", b =>
+ {
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Component", "Component")
+ .WithMany("RequestComponents")
+ .HasForeignKey("ComponentID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.PC", "PC")
+ .WithMany("Components")
+ .HasForeignKey("PCID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerStoreDatabaseImplement.Models.Request", "Request")
+ .WithMany("PCs")
+ .HasForeignKey("RequestID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Component");
+
+ b.Navigation("PC");
+
+ b.Navigation("Request");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Component", b =>
+ {
+ b.Navigation("ConsignmentComponents");
+
+ b.Navigation("RequestComponents");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Consignment", b =>
+ {
+ b.Navigation("Products");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Employee", b =>
+ {
+ b.Navigation("PCs");
+
+ b.Navigation("Products");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Order", b =>
+ {
+ b.Navigation("_consignments");
+
+ b.Navigation("_requests");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.PC", b =>
+ {
+ b.Navigation("Components");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Product", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Consignments");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Request", b =>
+ {
+ b.Navigation("PCs");
+ });
+
+ modelBuilder.Entity("ComputerStoreDatabaseImplement.Models.Seller", b =>
+ {
+ b.Navigation("Orders");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/ComputerStoreDatabaseImplement/Migrations/20230517185727_RelationFixesV3.cs b/ComputerStoreDatabaseImplement/Migrations/20230517185727_RelationFixesV3.cs
new file mode 100644
index 0000000..fda75e8
--- /dev/null
+++ b/ComputerStoreDatabaseImplement/Migrations/20230517185727_RelationFixesV3.cs
@@ -0,0 +1,22 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ComputerStoreDatabaseImplement.Migrations
+{
+ ///
+ public partial class RelationFixesV3 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/ComputerStoreDatabaseImplement/Migrations/ComputerStoreDatabaseModelSnapshot.cs b/ComputerStoreDatabaseImplement/Migrations/ComputerStoreDatabaseModelSnapshot.cs
index f6b3b2d..b116199 100644
--- a/ComputerStoreDatabaseImplement/Migrations/ComputerStoreDatabaseModelSnapshot.cs
+++ b/ComputerStoreDatabaseImplement/Migrations/ComputerStoreDatabaseModelSnapshot.cs
@@ -271,7 +271,7 @@ namespace ComputerStoreDatabaseImplement.Migrations
b.Property("Count")
.HasColumnType("int");
- b.Property("PCID")
+ b.Property("PCID")
.HasColumnType("int");
b.Property("RequestID")
@@ -425,7 +425,9 @@ namespace ComputerStoreDatabaseImplement.Migrations
b.HasOne("ComputerStoreDatabaseImplement.Models.PC", "PC")
.WithMany("Components")
- .HasForeignKey("PCID");
+ .HasForeignKey("PCID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
b.HasOne("ComputerStoreDatabaseImplement.Models.Request", "Request")
.WithMany("PCs")
diff --git a/ComputerStoreDatabaseImplement/Models/PC.cs b/ComputerStoreDatabaseImplement/Models/PC.cs
index 3714977..93dd12e 100644
--- a/ComputerStoreDatabaseImplement/Models/PC.cs
+++ b/ComputerStoreDatabaseImplement/Models/PC.cs
@@ -44,7 +44,7 @@ namespace ComputerStoreDatabaseImplement.Models
}
[ForeignKey("PCID")]
- public virtual List Components { get; set; } = new();
+ public virtual List? Components { get; set; } = new();
public virtual Employee Employee { get; set; }
diff --git a/ComputerStoreDatabaseImplement/Models/RequestComponent.cs b/ComputerStoreDatabaseImplement/Models/RequestComponent.cs
index 3e54ed0..d05348f 100644
--- a/ComputerStoreDatabaseImplement/Models/RequestComponent.cs
+++ b/ComputerStoreDatabaseImplement/Models/RequestComponent.cs
@@ -18,7 +18,7 @@ namespace ComputerStoreDatabaseImplement.Models
public int ComponentID { get; set; }
- public int? PCID { get; set; }
+ public int PCID { get; set; }
[Required]
public int Count { get; set; }