diff --git a/Secure/SecureShopClientApp/Controllers/HomeController.cs b/Secure/SecureShopClientApp/Controllers/HomeController.cs
index a3bc183..b3debda 100644
--- a/Secure/SecureShopClientApp/Controllers/HomeController.cs
+++ b/Secure/SecureShopClientApp/Controllers/HomeController.cs
@@ -39,7 +39,7 @@ namespace SecureShopClientApp.Controllers
{
if (APIClient.Client == null)
{
- throw new Exception("Вы как суда попали? Суда вход только авторизованным");
+ throw new Exception("Вы как суда попали?");
}
if (string.IsNullOrEmpty(login) || string.IsNullOrEmpty(password) || string.IsNullOrEmpty(fio))
{
@@ -99,7 +99,7 @@ namespace SecureShopClientApp.Controllers
{
throw new Exception("Введите логин, пароль и ФИО");
}
- APIClient.PostRequest("api/client/register", new ClientBindingModel
+ APIClient.PostRequest("api/Client/Register", new ClientBindingModel
{
ClientFIO = fio,
Email = login,
diff --git a/Secure/SecureShopClientApp/Program.cs b/Secure/SecureShopClientApp/Program.cs
index 0727468..7641f0e 100644
--- a/Secure/SecureShopClientApp/Program.cs
+++ b/Secure/SecureShopClientApp/Program.cs
@@ -1,10 +1,12 @@
+using SecureShopClientApp;
+
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
var app = builder.Build();
-
+APIClient.Connect(builder.Configuration);
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
diff --git a/Secure/SecureShopClientApp/appsettings.json b/Secure/SecureShopClientApp/appsettings.json
index 64e07df..c665091 100644
--- a/Secure/SecureShopClientApp/appsettings.json
+++ b/Secure/SecureShopClientApp/appsettings.json
@@ -6,5 +6,5 @@
}
},
"AllowedHosts": "*",
- "IPAddress": "http://localhost:5195"
+ "IPAddress": "https://localhost:7028"
}
diff --git a/Secure/SecureShopDatabaseImplement/Migrations/20230504094937_Client add.Designer.cs b/Secure/SecureShopDatabaseImplement/Migrations/20230504094937_Client add.Designer.cs
new file mode 100644
index 0000000..b8b8cf8
--- /dev/null
+++ b/Secure/SecureShopDatabaseImplement/Migrations/20230504094937_Client add.Designer.cs
@@ -0,0 +1,214 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using SecureShopDatabaseImplement;
+
+#nullable disable
+
+namespace SecureShopDatabaseImplement.Migrations
+{
+ [DbContext(typeof(SecureShopDatabase))]
+ [Migration("20230504094937_Client add")]
+ partial class Clientadd
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.5")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.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("SecureShopDatabaseImplement.Models.Facilities", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Cost")
+ .HasColumnType("float");
+
+ b.Property("FacilitiesName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Facilitiess");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.Order", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("DateCreate")
+ .HasColumnType("datetime2");
+
+ b.Property("DateImplement")
+ .HasColumnType("datetime2");
+
+ b.Property("SecureId")
+ .HasColumnType("int");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("Sum")
+ .HasColumnType("float");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ClientId");
+
+ b.HasIndex("SecureId");
+
+ b.ToTable("Orders");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.Secure", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Price")
+ .HasColumnType("float");
+
+ b.Property("SecureName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Secures");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.SecureFacilities", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Count")
+ .HasColumnType("int");
+
+ b.Property("FacilitiesId")
+ .HasColumnType("int");
+
+ b.Property("SecureId")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("FacilitiesId");
+
+ b.HasIndex("SecureId");
+
+ b.ToTable("SecureFacilitiess");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.Order", b =>
+ {
+ b.HasOne("SecureShopDatabaseImplement.Models.Client", "Client")
+ .WithMany("Orders")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SecureShopDatabaseImplement.Models.Secure", "Secure")
+ .WithMany("Orders")
+ .HasForeignKey("SecureId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+
+ b.Navigation("Secure");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.SecureFacilities", b =>
+ {
+ b.HasOne("SecureShopDatabaseImplement.Models.Facilities", "Facilities")
+ .WithMany("SecureFacilitiess")
+ .HasForeignKey("FacilitiesId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("SecureShopDatabaseImplement.Models.Secure", "Secure")
+ .WithMany("Facilitiess")
+ .HasForeignKey("SecureId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Facilities");
+
+ b.Navigation("Secure");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Orders");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.Facilities", b =>
+ {
+ b.Navigation("SecureFacilitiess");
+ });
+
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.Secure", b =>
+ {
+ b.Navigation("Facilitiess");
+
+ b.Navigation("Orders");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Secure/SecureShopDatabaseImplement/Migrations/20230504094937_Client add.cs b/Secure/SecureShopDatabaseImplement/Migrations/20230504094937_Client add.cs
new file mode 100644
index 0000000..3842e0b
--- /dev/null
+++ b/Secure/SecureShopDatabaseImplement/Migrations/20230504094937_Client add.cs
@@ -0,0 +1,69 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace SecureShopDatabaseImplement.Migrations
+{
+ ///
+ public partial class Clientadd : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.Sql("DELETE FROM [dbo].[Orders]");
+ migrationBuilder.AddColumn(
+ name: "ClientId",
+ table: "Orders",
+ type: "int",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.CreateTable(
+ name: "Clients",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ClientFIO = table.Column(type: "nvarchar(max)", nullable: false),
+ Email = table.Column(type: "nvarchar(max)", nullable: false),
+ Password = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Clients", x => x.Id);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Orders_ClientId",
+ table: "Orders",
+ column: "ClientId");
+
+ 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_Orders_Clients_ClientId",
+ table: "Orders");
+
+ migrationBuilder.DropTable(
+ name: "Clients");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Orders_ClientId",
+ table: "Orders");
+
+ migrationBuilder.DropColumn(
+ name: "ClientId",
+ table: "Orders");
+ }
+ }
+}
diff --git a/Secure/SecureShopDatabaseImplement/Migrations/SecureShopDatabaseModelSnapshot.cs b/Secure/SecureShopDatabaseImplement/Migrations/SecureShopDatabaseModelSnapshot.cs
index fe6c5b9..cc29fc3 100644
--- a/Secure/SecureShopDatabaseImplement/Migrations/SecureShopDatabaseModelSnapshot.cs
+++ b/Secure/SecureShopDatabaseImplement/Migrations/SecureShopDatabaseModelSnapshot.cs
@@ -17,11 +17,36 @@ namespace SecureShopDatabaseImplement.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "7.0.4")
+ .HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+ modelBuilder.Entity("SecureShopDatabaseImplement.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("SecureShopDatabaseImplement.Models.Facilities", b =>
{
b.Property("Id")
@@ -50,6 +75,9 @@ namespace SecureShopDatabaseImplement.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+ b.Property("ClientId")
+ .HasColumnType("int");
+
b.Property("Count")
.HasColumnType("int");
@@ -70,6 +98,8 @@ namespace SecureShopDatabaseImplement.Migrations
b.HasKey("Id");
+ b.HasIndex("ClientId");
+
b.HasIndex("SecureId");
b.ToTable("Orders");
@@ -123,12 +153,20 @@ namespace SecureShopDatabaseImplement.Migrations
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Order", b =>
{
+ b.HasOne("SecureShopDatabaseImplement.Models.Client", "Client")
+ .WithMany("Orders")
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
b.HasOne("SecureShopDatabaseImplement.Models.Secure", "Secure")
.WithMany("Orders")
.HasForeignKey("SecureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
+ b.Navigation("Client");
+
b.Navigation("Secure");
});
@@ -151,6 +189,11 @@ namespace SecureShopDatabaseImplement.Migrations
b.Navigation("Secure");
});
+ modelBuilder.Entity("SecureShopDatabaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Orders");
+ });
+
modelBuilder.Entity("SecureShopDatabaseImplement.Models.Facilities", b =>
{
b.Navigation("SecureFacilitiess");