diff --git a/ElectronicsShop/ElectronicsShop.sln b/ElectronicsShop/ElectronicsShop.sln
index da16eb8..e4689fb 100644
--- a/ElectronicsShop/ElectronicsShop.sln
+++ b/ElectronicsShop/ElectronicsShop.sln
@@ -11,14 +11,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicsShopBusinessLogi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicsShopDataBaseImplement", "ElectronicsShopDataBaseImplement\ElectronicsShopDataBaseImplement.csproj", "{03442D38-4C09-49D1-85F3-F8F563072F9B}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicsShopRestAPI", "ElectronicsShopResrAPI\ElectronicsShopRestAPI.csproj", "{BDEC8526-DB9D-49F3-93B5-8777339CC040}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicsShopClientApp", "ElectronicsShopClientApp\ElectronicsShopClientApp.csproj", "{6EDC1439-C558-46A4-BFF9-3BA3B66044C7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicsShopShopClientApp", "ElectronicsShopShopClientApp\ElectronicsShopShopClientApp.csproj", "{029A15C5-BBCE-415E-A3EC-80568D54852A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicsShopEmployeeApp", "ElectronicsShopEmployeeApp\ElectronicsShopEmployeeApp.csproj", "{EEDB8074-33B3-409C-A3DD-AF6B403CC907}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElectronicsShopRestAPI", "ElectronicsShopRestAPI\ElectronicsShopRestAPI.csproj", "{BCC79812-AE38-45C2-9A2A-87A24827FA48}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -41,10 +41,6 @@ Global
{03442D38-4C09-49D1-85F3-F8F563072F9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03442D38-4C09-49D1-85F3-F8F563072F9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03442D38-4C09-49D1-85F3-F8F563072F9B}.Release|Any CPU.Build.0 = Release|Any CPU
- {BDEC8526-DB9D-49F3-93B5-8777339CC040}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BDEC8526-DB9D-49F3-93B5-8777339CC040}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BDEC8526-DB9D-49F3-93B5-8777339CC040}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BDEC8526-DB9D-49F3-93B5-8777339CC040}.Release|Any CPU.Build.0 = Release|Any CPU
{6EDC1439-C558-46A4-BFF9-3BA3B66044C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6EDC1439-C558-46A4-BFF9-3BA3B66044C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6EDC1439-C558-46A4-BFF9-3BA3B66044C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -57,6 +53,10 @@ Global
{EEDB8074-33B3-409C-A3DD-AF6B403CC907}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EEDB8074-33B3-409C-A3DD-AF6B403CC907}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EEDB8074-33B3-409C-A3DD-AF6B403CC907}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BCC79812-AE38-45C2-9A2A-87A24827FA48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BCC79812-AE38-45C2-9A2A-87A24827FA48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BCC79812-AE38-45C2-9A2A-87A24827FA48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BCC79812-AE38-45C2-9A2A-87A24827FA48}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ClientLogic.cs b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ClientLogic.cs
index 2885afd..dc964db 100644
--- a/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ClientLogic.cs
+++ b/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ClientLogic.cs
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
namespace ElectronicsShopBusinessLogic.BusinessLogic
{
- internal class ClientLogic : IClientLogic
+ public class ClientLogic : IClientLogic
{
private readonly ILogger _logger;
private readonly IClientStorage _storage;
@@ -113,7 +113,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic
{
Email= model.Email
});
- if (element != null && element.Email != model.Email)
+ if (element != null && element.Email == model.Email)
{
throw new InvalidOperationException("Клиент с такой почтой уже есть");
}
diff --git a/ElectronicsShop/ElectronicsShopContracts/SearchModels/EmployeeSearchModel.cs b/ElectronicsShop/ElectronicsShopContracts/SearchModels/EmployeeSearchModel.cs
index 50c1703..1387df1 100644
--- a/ElectronicsShop/ElectronicsShopContracts/SearchModels/EmployeeSearchModel.cs
+++ b/ElectronicsShop/ElectronicsShopContracts/SearchModels/EmployeeSearchModel.cs
@@ -12,5 +12,6 @@ namespace ElectronicsShopContracts.SearchModels
public int? ID { get; set; }
public string? EmployeFIO { get; set; }
public string? Login { get; set; }
+ public string? Password { get; set; }
}
}
diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240526155227_Migration02.Designer.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240526155227_Migration02.Designer.cs
new file mode 100644
index 0000000..1b7a36c
--- /dev/null
+++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240526155227_Migration02.Designer.cs
@@ -0,0 +1,254 @@
+//
+using System;
+using ElectronicsShopDataBaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace ElectronicsShopDataBaseImplement.Migrations
+{
+ [DbContext(typeof(Database))]
+ [Migration("20240526155227_Migration02")]
+ partial class Migration02
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.4")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.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("ElectronicsShopDataBaseImplement.Models.CostItem", 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.ToTable("CostItems");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("EmployeeFIO")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Login")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Employees");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.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("Sum")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("ClientID");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.Property("_productID")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ProductID");
+
+ b.HasIndex("_productID");
+
+ b.ToTable("OrderProducts");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("PayOption")
+ .HasColumnType("int");
+
+ b.Property("PaymentID")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.Property("SumPayment")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("PaymentID");
+
+ b.ToTable("Paymeants");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("CostItemID")
+ .HasColumnType("int");
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("ProductName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("ID");
+
+ b.ToTable("Products");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
+ .WithMany("Orders")
+ .HasForeignKey("ClientID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
+ .WithMany("Products")
+ .HasForeignKey("ProductID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
+ .WithMany()
+ .HasForeignKey("_productID");
+
+ b.Navigation("_order");
+
+ b.Navigation("_product");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", null)
+ .WithMany("Payments")
+ .HasForeignKey("PaymentID");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
+ {
+ b.Navigation("Payments");
+
+ b.Navigation("Products");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240526155227_Migration02.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240526155227_Migration02.cs
new file mode 100644
index 0000000..d6a861a
--- /dev/null
+++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/20240526155227_Migration02.cs
@@ -0,0 +1,175 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace ElectronicsShopDataBaseImplement.Migrations
+{
+ ///
+ public partial class Migration02 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_OrderProducts_Orders__orderID",
+ table: "OrderProducts");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_OrderProducts_Products_ProductID",
+ table: "OrderProducts");
+
+ migrationBuilder.DropIndex(
+ name: "IX_OrderProducts__orderID",
+ table: "OrderProducts");
+
+ migrationBuilder.DropColumn(
+ name: "EmployeeID",
+ table: "Orders");
+
+ migrationBuilder.DropColumn(
+ name: "OrdersID",
+ table: "OrderProducts");
+
+ migrationBuilder.RenameColumn(
+ name: "_orderID",
+ table: "OrderProducts",
+ newName: "OrderID");
+
+ migrationBuilder.AddColumn(
+ name: "_productID",
+ table: "OrderProducts",
+ type: "int",
+ nullable: true);
+
+ migrationBuilder.CreateTable(
+ name: "Paymeants",
+ columns: table => new
+ {
+ ID = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ProductID = table.Column(type: "int", nullable: false),
+ OrderID = table.Column(type: "int", nullable: false),
+ SumPayment = table.Column(type: "float", nullable: false),
+ PayOption = table.Column(type: "int", nullable: false),
+ PaymentID = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Paymeants", x => x.ID);
+ table.ForeignKey(
+ name: "FK_Paymeants_Orders_PaymentID",
+ column: x => x.PaymentID,
+ principalTable: "Orders",
+ principalColumn: "ID");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Orders_ClientID",
+ table: "Orders",
+ column: "ClientID");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_OrderProducts__productID",
+ table: "OrderProducts",
+ column: "_productID");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Paymeants_PaymentID",
+ table: "Paymeants",
+ column: "PaymentID");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_OrderProducts_Orders_ProductID",
+ table: "OrderProducts",
+ column: "ProductID",
+ principalTable: "Orders",
+ principalColumn: "ID",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_OrderProducts_Products__productID",
+ table: "OrderProducts",
+ column: "_productID",
+ principalTable: "Products",
+ principalColumn: "ID");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Orders_Clients_ClientID",
+ table: "Orders",
+ column: "ClientID",
+ principalTable: "Clients",
+ principalColumn: "ID",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_OrderProducts_Orders_ProductID",
+ table: "OrderProducts");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_OrderProducts_Products__productID",
+ table: "OrderProducts");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Orders_Clients_ClientID",
+ table: "Orders");
+
+ migrationBuilder.DropTable(
+ name: "Paymeants");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Orders_ClientID",
+ table: "Orders");
+
+ migrationBuilder.DropIndex(
+ name: "IX_OrderProducts__productID",
+ table: "OrderProducts");
+
+ migrationBuilder.DropColumn(
+ name: "_productID",
+ table: "OrderProducts");
+
+ migrationBuilder.RenameColumn(
+ name: "OrderID",
+ table: "OrderProducts",
+ newName: "_orderID");
+
+ migrationBuilder.AddColumn(
+ name: "EmployeeID",
+ table: "Orders",
+ type: "int",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "OrdersID",
+ table: "OrderProducts",
+ type: "int",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.CreateIndex(
+ name: "IX_OrderProducts__orderID",
+ table: "OrderProducts",
+ column: "_orderID");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_OrderProducts_Orders__orderID",
+ table: "OrderProducts",
+ column: "_orderID",
+ principalTable: "Orders",
+ principalColumn: "ID",
+ onDelete: ReferentialAction.Cascade);
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_OrderProducts_Products_ProductID",
+ table: "OrderProducts",
+ column: "ProductID",
+ principalTable: "Products",
+ principalColumn: "ID",
+ onDelete: ReferentialAction.Cascade);
+ }
+ }
+}
diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs
index e502173..44aa1c4 100644
--- a/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs
+++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Migrations/DatabaseModelSnapshot.cs
@@ -109,14 +109,13 @@ namespace ElectronicsShopDataBaseImplement.Migrations
b.Property("DateCreate")
.HasColumnType("datetime2");
- b.Property("EmployeeID")
- .HasColumnType("int");
-
b.Property("Sum")
.HasColumnType("float");
b.HasKey("ID");
+ b.HasIndex("ClientID");
+
b.ToTable("Orders");
});
@@ -131,24 +130,54 @@ namespace ElectronicsShopDataBaseImplement.Migrations
b.Property("Count")
.HasColumnType("int");
- b.Property("OrdersID")
+ b.Property("OrderID")
.HasColumnType("int");
b.Property("ProductID")
.HasColumnType("int");
- b.Property("_orderID")
+ b.Property("_productID")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ProductID");
- b.HasIndex("_orderID");
+ b.HasIndex("_productID");
b.ToTable("OrderProducts");
});
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
+ {
+ b.Property("ID")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ID"));
+
+ b.Property("OrderID")
+ .HasColumnType("int");
+
+ b.Property("PayOption")
+ .HasColumnType("int");
+
+ b.Property("PaymentID")
+ .HasColumnType("int");
+
+ b.Property("ProductID")
+ .HasColumnType("int");
+
+ b.Property("SumPayment")
+ .HasColumnType("float");
+
+ b.HasKey("ID");
+
+ b.HasIndex("PaymentID");
+
+ b.ToTable("Paymeants");
+ });
+
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
{
b.Property("ID")
@@ -172,27 +201,48 @@ namespace ElectronicsShopDataBaseImplement.Migrations
b.ToTable("Products");
});
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Client", null)
+ .WithMany("Orders")
+ .HasForeignKey("ClientID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
{
- b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
- .WithMany()
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
+ .WithMany("Products")
.HasForeignKey("ProductID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
- b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
- .WithMany("Products")
- .HasForeignKey("_orderID")
- .OnDelete(DeleteBehavior.Cascade)
- .IsRequired();
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
+ .WithMany()
+ .HasForeignKey("_productID");
b.Navigation("_order");
b.Navigation("_product");
});
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Paymeant", b =>
+ {
+ b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", null)
+ .WithMany("Payments")
+ .HasForeignKey("PaymentID");
+ });
+
+ modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Orders");
+ });
+
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
{
+ b.Navigation("Payments");
+
b.Navigation("Products");
});
#pragma warning restore 612, 618
diff --git a/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/OrderProduct.cs b/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/OrderProduct.cs
index 2b7f967..c592e73 100644
--- a/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/OrderProduct.cs
+++ b/ElectronicsShop/ElectronicsShopDataBaseImplement/Models/OrderProduct.cs
@@ -11,19 +11,16 @@ namespace ElectronicsShopDataBaseImplement.Models
public class OrderProduct
{
public int Id { get; set; }
- [ForeignKey("OrderID")]
- public int OrdersID { get; set; }
- [ForeignKey("ProductID")]
+ public int OrderID { get; set; }
+
public int ProductID { get; set; }
[Required]
public int Count { get; set; }
- [ForeignKey("OrderID")]
public virtual Order _order { get; set; } = new();
- [ForeignKey("ProductID")]
public virtual Product _product { get; set; } = new();
}
}
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/Controllers/ClientController.cs b/ElectronicsShop/ElectronicsShopResrAPI/Controllers/ClientController.cs
deleted file mode 100644
index ebc43da..0000000
--- a/ElectronicsShop/ElectronicsShopResrAPI/Controllers/ClientController.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using ElectronicsShopContracts.BindingModels;
-using ElectronicsShopContracts.ViewModels;
-using Microsoft.AspNetCore.Mvc;
-
-namespace ElectronicsShopRestAPI.Controllers {
-
- [Route("api/[controller]/[action]")]
- [ApiController]
-
- public class ClientController : Controller {
-
- private readonly ILogger _logger;
-
- public ClientController(ILogger logger) {
- _logger = logger;
- }
-
- [HttpGet]
- public ClientViewModel? Login(string email, string password) {
- return null;
- }
-
- [HttpPost]
- public void Register(ClientBindingModel model) {
- return;
- }
-
- [HttpPost]
- public void UpdateData(ClientBindingModel model) {
- return;
- }
- }
-}
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/Controllers/EmployeeController.cs b/ElectronicsShop/ElectronicsShopResrAPI/Controllers/EmployeeController.cs
deleted file mode 100644
index ebe610f..0000000
--- a/ElectronicsShop/ElectronicsShopResrAPI/Controllers/EmployeeController.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using ElectronicsShopContracts.BindingModels;
-using ElectronicsShopContracts.ViewModels;
-using Microsoft.AspNetCore.Mvc;
-
-namespace ElectronicsShopRestAPI.Controllers {
-
- [Route("api/[controller]/[action]")]
- [ApiController]
-
- public class EmployeeController : Controller {
-
- private readonly ILogger _logger;
-
- public EmployeeController(ILogger logger) {
- _logger = logger;
- }
-
- [HttpGet]
- public EmployeeViewModel? Login(string login, string password) {
- return null;
- }
-
- [HttpPost]
- public void Register(EmployeeBindingModel model) {
- return;
- }
-
- [HttpPost]
- public void UpdateData(EmployeeBindingModel model) {
- return;
- }
- }
-}
diff --git a/ElectronicsShop/ElectronicsShopRestAPI/Controllers/ClientController.cs b/ElectronicsShop/ElectronicsShopRestAPI/Controllers/ClientController.cs
new file mode 100644
index 0000000..8ddf38f
--- /dev/null
+++ b/ElectronicsShop/ElectronicsShopRestAPI/Controllers/ClientController.cs
@@ -0,0 +1,58 @@
+using ElectronicsShopContracts.BindingModels;
+using ElectronicsShopContracts.BusinessLogicContracts;
+using ElectronicsShopContracts.SearchModels;
+using ElectronicsShopContracts.ViewModels;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ElectronicsShopRestAPI.Controllers {
+
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+
+ public class ClientController : Controller {
+
+ private readonly ILogger _logger;
+ private readonly IClientLogic _logic;
+
+ public ClientController(ILogger logger, IClientLogic logic) {
+ _logger = logger;
+ _logic = logic;
+ }
+
+ [HttpGet]
+ public ClientViewModel? Login(string email, string password) {
+ try {
+ return _logic.ReadElemet(new ClientSearchModel {
+ Email = email,
+ Passwrod = password
+ });
+ }
+ catch (Exception ex) {
+ _logger.LogError(ex, "Ошибка входа в систему");
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void Register(ClientBindingModel model) {
+ try {
+ _logic.Create(model);
+ }
+ catch (Exception ex) {
+ _logger.LogError(ex, "Ошибка регистрации");
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void UpdateData(ClientBindingModel model) {
+ try {
+ _logic.Update(model);
+ }
+ catch (Exception ex) {
+ _logger.LogError(ex, "Ошибка обновления данных");
+ throw;
+ }
+ }
+ }
+}
diff --git a/ElectronicsShop/ElectronicsShopRestAPI/Controllers/EmployeeController.cs b/ElectronicsShop/ElectronicsShopRestAPI/Controllers/EmployeeController.cs
new file mode 100644
index 0000000..6a296f8
--- /dev/null
+++ b/ElectronicsShop/ElectronicsShopRestAPI/Controllers/EmployeeController.cs
@@ -0,0 +1,58 @@
+using ElectronicsShopContracts.BindingModels;
+using ElectronicsShopContracts.BusinessLogicContracts;
+using ElectronicsShopContracts.SearchModels;
+using ElectronicsShopContracts.ViewModels;
+using Microsoft.AspNetCore.Mvc;
+
+namespace ElectronicsShopRestAPI.Controllers {
+
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+
+ public class EmployeeController : Controller {
+
+ private readonly ILogger _logger;
+ private readonly IEmployeeLogic _logic;
+
+ public EmployeeController(ILogger logger, IEmployeeLogic logic) {
+ _logger = logger;
+ _logic = logic;
+ }
+
+ [HttpGet]
+ public EmployeeViewModel? Login(string login, string password) {
+ try {
+ return _logic.ReadElemet(new EmployeeSearchModel {
+ Login = login,
+ Password = password
+ });
+ }
+ catch (Exception ex) {
+ _logger.LogError(ex, "Ошибка входа в систему");
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void Register(EmployeeBindingModel model) {
+ try {
+ _logic.Create(model);
+ }
+ catch (Exception ex) {
+ _logger.LogError(ex, "Ошибка регистрации");
+ throw;
+ }
+ }
+
+ [HttpPost]
+ public void UpdateData(EmployeeBindingModel model) {
+ try {
+ _logic.Update(model);
+ }
+ catch (Exception ex) {
+ _logger.LogError(ex, "Ошибка обновления данных");
+ throw;
+ }
+ }
+ }
+}
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/Controllers/MainController.cs b/ElectronicsShop/ElectronicsShopRestAPI/Controllers/MainController.cs
similarity index 100%
rename from ElectronicsShop/ElectronicsShopResrAPI/Controllers/MainController.cs
rename to ElectronicsShop/ElectronicsShopRestAPI/Controllers/MainController.cs
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/ElectronicsShopResrAPI.http b/ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopResrAPI.http
similarity index 100%
rename from ElectronicsShop/ElectronicsShopResrAPI/ElectronicsShopResrAPI.http
rename to ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopResrAPI.http
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/ElectronicsShopRestAPI.csproj b/ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopRestAPI.csproj
similarity index 61%
rename from ElectronicsShop/ElectronicsShopResrAPI/ElectronicsShopRestAPI.csproj
rename to ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopRestAPI.csproj
index eb343d5..9cc54fc 100644
--- a/ElectronicsShop/ElectronicsShopResrAPI/ElectronicsShopRestAPI.csproj
+++ b/ElectronicsShop/ElectronicsShopRestAPI/ElectronicsShopRestAPI.csproj
@@ -4,7 +4,7 @@
net8.0
enable
enable
- true
+ false
@@ -12,7 +12,9 @@
+
+
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/Program.cs b/ElectronicsShop/ElectronicsShopRestAPI/Program.cs
similarity index 69%
rename from ElectronicsShop/ElectronicsShopResrAPI/Program.cs
rename to ElectronicsShop/ElectronicsShopRestAPI/Program.cs
index 95732de..379c4e5 100644
--- a/ElectronicsShop/ElectronicsShopResrAPI/Program.cs
+++ b/ElectronicsShop/ElectronicsShopRestAPI/Program.cs
@@ -1,3 +1,7 @@
+using ElectronicsShopBusinessLogic.BusinessLogic;
+using ElectronicsShopContracts.BusinessLogicContracts;
+using ElectronicsShopContracts.StorageContracts;
+using ElectronicsShopDataBaseImplement.Implements;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
@@ -6,6 +10,10 @@ var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
+builder.Services.AddTransient();
+
+builder.Services.AddTransient();
+
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/Properties/launchSettings.json b/ElectronicsShop/ElectronicsShopRestAPI/Properties/launchSettings.json
similarity index 100%
rename from ElectronicsShop/ElectronicsShopResrAPI/Properties/launchSettings.json
rename to ElectronicsShop/ElectronicsShopRestAPI/Properties/launchSettings.json
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/appsettings.Development.json b/ElectronicsShop/ElectronicsShopRestAPI/appsettings.Development.json
similarity index 100%
rename from ElectronicsShop/ElectronicsShopResrAPI/appsettings.Development.json
rename to ElectronicsShop/ElectronicsShopRestAPI/appsettings.Development.json
diff --git a/ElectronicsShop/ElectronicsShopResrAPI/appsettings.json b/ElectronicsShop/ElectronicsShopRestAPI/appsettings.json
similarity index 100%
rename from ElectronicsShop/ElectronicsShopResrAPI/appsettings.json
rename to ElectronicsShop/ElectronicsShopRestAPI/appsettings.json
diff --git a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml
index c794a99..7862015 100644
--- a/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml
+++ b/ElectronicsShop/ElectronicsShopShopClientApp/Views/Home/Index.cshtml
@@ -26,9 +26,6 @@
Номер заказа
|
-
- Сотрудник
- |
Дата создания
|
@@ -43,9 +40,6 @@
@Html.DisplayFor(modelItem => item.ID)
|
-
- @Html.DisplayFor(modelItem => item.EmployeeID)
- |
@Html.DisplayFor(modelItem => item.DateCreate)
|