diff --git a/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20230520051723_fix.Designer.cs b/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20230520051723_fix.Designer.cs
new file mode 100644
index 0000000..8ff39b8
--- /dev/null
+++ b/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20230520051723_fix.Designer.cs
@@ -0,0 +1,540 @@
+//
+using System;
+using ComputerShopDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace ComputerShopDatabaseImplement.Migrations
+{
+ [DbContext(typeof(ComputerShopDatabase))]
+ [Migration("20230520051723_fix")]
+ partial class fix
+ {
+ ///
+ 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("ComputerShopDatabaseImplement.Models.Assembly", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AssemblyName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("Assemblies");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AssemblyId")
+ .HasColumnType("int");
+
+ b.Property("ComponentId")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AssemblyId");
+
+ b.HasIndex("ComponentId");
+
+ b.ToTable("AssemblyComponents");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyOrder", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AssemblyId")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("OrderId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AssemblyId");
+
+ b.HasIndex("OrderId");
+
+ b.ToTable("AssemblyOrders");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientFIO")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Clients");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("ComponentName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Cost")
+ .HasColumnType("float");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("Components");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ComponentId")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("SupplyId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ComponentId");
+
+ b.HasIndex("SupplyId");
+
+ b.ToTable("ComponentSupplies");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("EquipmentReceivings");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("Sum")
+ .HasColumnType("float");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("ComponentId")
+ .HasColumnType("int");
+
+ b.Property("ComponentName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("Sum")
+ .HasColumnType("float");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.HasIndex("ComponentId");
+
+ b.ToTable("Purchases");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("OrderId")
+ .HasColumnType("int");
+
+ b.Property("ReceivingId")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.HasIndex("ReceivingId");
+
+ b.ToTable("Supplies");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("OrderId")
+ .HasColumnType("int");
+
+ b.Property("SupplyId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("OrderId");
+
+ b.HasIndex("SupplyId");
+
+ b.ToTable("SupplyOrders");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
+ .WithMany("Assemblies")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
+ .WithMany("Components")
+ .HasForeignKey("AssemblyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
+ .WithMany("AssemblyComponents")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Assembly");
+
+ b.Navigation("Component");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyOrder", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
+ .WithMany("Orders")
+ .HasForeignKey("AssemblyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
+ .WithMany("Assemblies")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Assembly");
+
+ b.Navigation("Order");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
+ .WithMany("Components")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
+ .WithMany("Supplies")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
+ .WithMany("ComponentSupplies")
+ .HasForeignKey("SupplyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Component");
+
+ b.Navigation("Supply");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
+ .WithMany("EquipmentReceivings")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
+ .WithMany("Orders")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
+ .WithMany("Purchases")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
+ .WithMany("Purchases")
+ .HasForeignKey("ComponentId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+
+ b.Navigation("Component");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
+ .WithMany("Supplies")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
+ .WithMany("Supplies")
+ .HasForeignKey("ReceivingId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Receiving");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
+ {
+ b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
+ .WithMany("SupplyOrders")
+ .HasForeignKey("OrderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
+ .WithMany("Orders")
+ .HasForeignKey("SupplyId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Order");
+
+ b.Navigation("Supply");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
+ {
+ b.Navigation("Components");
+
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Assemblies");
+
+ b.Navigation("Components");
+
+ b.Navigation("EquipmentReceivings");
+
+ b.Navigation("Orders");
+
+ b.Navigation("Purchases");
+
+ b.Navigation("Supplies");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
+ {
+ b.Navigation("AssemblyComponents");
+
+ b.Navigation("Purchases");
+
+ b.Navigation("Supplies");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
+ {
+ b.Navigation("Supplies");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
+ {
+ b.Navigation("Assemblies");
+
+ b.Navigation("SupplyOrders");
+ });
+
+ modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
+ {
+ b.Navigation("ComponentSupplies");
+
+ b.Navigation("Orders");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20230520051723_fix.cs b/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20230520051723_fix.cs
new file mode 100644
index 0000000..370d04a
--- /dev/null
+++ b/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20230520051723_fix.cs
@@ -0,0 +1,141 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ComputerShopDatabaseImplement.Migrations
+{
+ ///
+ public partial class fix : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_EquipmentReceivings_Clients_ClientId",
+ table: "EquipmentReceivings");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Orders_Clients_ClientId",
+ table: "Orders");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Supplies_Clients_ClientId",
+ table: "Supplies");
+
+ migrationBuilder.AlterColumn(
+ name: "ClientId",
+ table: "Supplies",
+ type: "int",
+ nullable: false,
+ defaultValue: 0,
+ oldClrType: typeof(int),
+ oldType: "int",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "ClientId",
+ table: "Orders",
+ type: "int",
+ nullable: false,
+ defaultValue: 0,
+ oldClrType: typeof(int),
+ oldType: "int",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "ClientId",
+ table: "EquipmentReceivings",
+ type: "int",
+ nullable: false,
+ defaultValue: 0,
+ oldClrType: typeof(int),
+ oldType: "int",
+ oldNullable: true);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EquipmentReceivings_Clients_ClientId",
+ table: "EquipmentReceivings",
+ column: "ClientId",
+ principalTable: "Clients",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.NoAction);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Orders_Clients_ClientId",
+ table: "Orders",
+ column: "ClientId",
+ principalTable: "Clients",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.NoAction);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Supplies_Clients_ClientId",
+ table: "Supplies",
+ column: "ClientId",
+ principalTable: "Clients",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.NoAction);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_EquipmentReceivings_Clients_ClientId",
+ table: "EquipmentReceivings");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Orders_Clients_ClientId",
+ table: "Orders");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Supplies_Clients_ClientId",
+ table: "Supplies");
+
+ migrationBuilder.AlterColumn(
+ name: "ClientId",
+ table: "Supplies",
+ type: "int",
+ nullable: true,
+ oldClrType: typeof(int),
+ oldType: "int");
+
+ migrationBuilder.AlterColumn(
+ name: "ClientId",
+ table: "Orders",
+ type: "int",
+ nullable: true,
+ oldClrType: typeof(int),
+ oldType: "int");
+
+ migrationBuilder.AlterColumn(
+ name: "ClientId",
+ table: "EquipmentReceivings",
+ type: "int",
+ nullable: true,
+ oldClrType: typeof(int),
+ oldType: "int");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_EquipmentReceivings_Clients_ClientId",
+ table: "EquipmentReceivings",
+ column: "ClientId",
+ principalTable: "Clients",
+ principalColumn: "Id");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Orders_Clients_ClientId",
+ table: "Orders",
+ column: "ClientId",
+ principalTable: "Clients",
+ principalColumn: "Id");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Supplies_Clients_ClientId",
+ table: "Supplies",
+ column: "ClientId",
+ principalTable: "Clients",
+ principalColumn: "Id");
+ }
+ }
+}
diff --git a/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/ComputerShopDatabaseModelSnapshot.cs b/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/ComputerShopDatabaseModelSnapshot.cs
index a1ed3ab..71fe12d 100644
--- a/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/ComputerShopDatabaseModelSnapshot.cs
+++ b/ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/ComputerShopDatabaseModelSnapshot.cs
@@ -183,7 +183,7 @@ namespace ComputerShopDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
- b.Property("ClientId")
+ b.Property("ClientId")
.HasColumnType("int");
b.Property("DateImplement")
@@ -207,7 +207,7 @@ namespace ComputerShopDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
- b.Property("ClientId")
+ b.Property("ClientId")
.HasColumnType("int");
b.Property("DateCreate")
@@ -279,7 +279,7 @@ namespace ComputerShopDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
- b.Property("ClientId")
+ b.Property("ClientId")
.HasColumnType("int");
b.Property("DateCreate")
@@ -413,14 +413,18 @@ namespace ComputerShopDatabaseImplement.Migrations
{
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
.WithMany("EquipmentReceivings")
- .HasForeignKey("ClientId");
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
{
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
.WithMany("Orders")
- .HasForeignKey("ClientId");
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
});
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
@@ -446,13 +450,17 @@ namespace ComputerShopDatabaseImplement.Migrations
{
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
.WithMany("Supplies")
- .HasForeignKey("ClientId");
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
- b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", null)
+ b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
.WithMany("Supplies")
.HasForeignKey("ReceivingId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+
+ b.Navigation("Receiving");
});
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
diff --git a/ComputerShopProvider/ComputerShopRestApi/Controllers/EquipmentReceivingController.cs b/ComputerShopProvider/ComputerShopRestApi/Controllers/EquipmentReceivingController.cs
index c7bcaae..8d03fc5 100644
--- a/ComputerShopProvider/ComputerShopRestApi/Controllers/EquipmentReceivingController.cs
+++ b/ComputerShopProvider/ComputerShopRestApi/Controllers/EquipmentReceivingController.cs
@@ -44,7 +44,7 @@ namespace ComputerShopRestApi.Controllers
}
catch (Exception ex)
{
- _logger.LogError(ex, "Ошибка получения списка закупок клиента id ={ Id}", clientId);
+ _logger.LogError(ex, "Ошибка получения списка получений клиента id ={ Id}", clientId);
throw;
}
}
diff --git a/ComputerShopProvider/ComputerShopRestApi/Controllers/SupplyController.cs b/ComputerShopProvider/ComputerShopRestApi/Controllers/SupplyController.cs
index 249a20c..5e7e4e0 100644
--- a/ComputerShopProvider/ComputerShopRestApi/Controllers/SupplyController.cs
+++ b/ComputerShopProvider/ComputerShopRestApi/Controllers/SupplyController.cs
@@ -25,15 +25,19 @@ namespace ComputerShopRestApi.Controllers
}
[HttpGet]
- public List? GetReceivingList()
+ public List? GetReceivingList(int clientId)
{
+
try
{
- return _equipmentReceiving.ReadList(null);
+ return _equipmentReceiving.ReadList(new EquipmentReceivingSearchModel
+ {
+ ClientId = clientId
+ });
}
catch (Exception ex)
{
- _logger.LogError(ex, "Ошибка получения списка компонентов");
+ _logger.LogError(ex, "Ошибка получения списка поставок клиента id ={ Id}", clientId);
throw;
}
}
@@ -66,7 +70,7 @@ namespace ComputerShopRestApi.Controllers
}
}
[HttpPost]
- public void CreateAssembly(SupplyBindingModel model)
+ public void CreateSupply(SupplyBindingModel model)
{
try
{
diff --git a/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs b/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs
index b583d67..aa2f29a 100644
--- a/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs
+++ b/ComputerShopProvider/OrdererClientApp/Controllers/HomeController.cs
@@ -127,54 +127,43 @@ namespace OrdererClientApp.Controllers
}
[HttpGet]
- public IActionResult CreatePurchase()
+ public IActionResult CreateEquipmentReceiving()
{
- ViewBag.Components = APIClient.GetRequest>("api/main/getcomponentlist");
+ ViewBag.EquipmentReceivings = APIClient.GetRequest>("api/main/getreceivingslist");
return View();
}
[HttpPost]
- public void CreatePurchase(int component, int count)
+ public void CreateSupply(int receiving)
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
- if (count <= 0)
- {
- throw new Exception("Количество и сумма должны быть больше 0");
- }
- APIClient.PostRequest("api/main/createpurchase", new PurchaseBindingModel
+
+ APIClient.PostRequest("api/main/createreceiving", new SupplyBindingModel
{
ClientId = APIClient.Client.Id,
- ComponentId = component,
- Count = count,
- Sum = Calc(count, component)
+ ReceivingId = receiving,
});
Response.Redirect("Index");
}
[HttpGet]
- public IActionResult CreateComponent()
+ public IActionResult CreateOrder()
{
return View();
}
[HttpPost]
- public void CreateComponent(string name, int cost)
+ public void CreateOrder(int sum)
{
if (APIClient.Client == null)
{
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
}
- if (cost <= 0)
- {
- throw new Exception("Цена должна быть больше 0");
- }
- APIClient.PostRequest("api/component/createcomponent", new ComponentBindingModel
+ APIClient.PostRequest("api/order/createorder", new OrderBindingModel
{
ClientId = APIClient.Client.Id,
- ComponentName = name,
- Cost = cost
});
Response.Redirect("Index");
}
@@ -218,13 +207,13 @@ namespace OrdererClientApp.Controllers
{
throw new Exception("Сумма должна быть больше 0");
}
- //APIClient.PostRequest("api/assembly/createassembly", new AssemblyBindingModel
- //{
- // ClientId = APIClient.Client.Id,
- // AssemblyName = name,
- // Price = 0,
- // AssemblyComponents = new()
- //});
+ APIClient.PostRequest("api/assembly/createassembly", new AssemblyBindingModel
+ {
+ ClientId = APIClient.Client.Id,
+ AssemblyName = name,
+ Price = 0,
+ AssemblyComponents = new()
+ });
System.Diagnostics.Debug.WriteLine("it might work");
Response.Redirect("Index");
}