I big MEEEE
This commit is contained in:
parent
55e743f915
commit
12851df7fc
@ -93,7 +93,7 @@ namespace ElectronicsShopBusinessLogic.BusinessLogic {
|
|||||||
var element = _storage.GetElement(new EmployeeSearchModel {
|
var element = _storage.GetElement(new EmployeeSearchModel {
|
||||||
Login = model.Login
|
Login = model.Login
|
||||||
});
|
});
|
||||||
if (element != null && element.Login != model.Login) {
|
if (element != null && element.Login == model.Login) {
|
||||||
throw new InvalidOperationException("Сотрудник с таким логином уже есть");
|
throw new InvalidOperationException("Сотрудник с таким логином уже есть");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace ElectronicsShopDataBaseImplement
|
|||||||
optionsBuilder)
|
optionsBuilder)
|
||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false) {
|
if (optionsBuilder.IsConfigured == false) {
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-O0N00SH\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-E2VPEN3\SQLEXPRESS;Initial Catalog=ElectronicsShopDatabase11;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
@ -1,204 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
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("20240525133056_InitMigration")]
|
|
||||||
partial class InitMigration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
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<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("ClientFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.CostItem", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("EmployeeID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("CostItems");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Employee", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<string>("EmployeeFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Login")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Employees");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("EmployeeID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("OrdersID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("ProductID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("_orderID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ProductID");
|
|
||||||
|
|
||||||
b.HasIndex("_orderID");
|
|
||||||
|
|
||||||
b.ToTable("OrderProducts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Product", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("ID")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));
|
|
||||||
|
|
||||||
b.Property<int>("CostItemID")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("ProductName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("ID");
|
|
||||||
|
|
||||||
b.ToTable("Products");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.OrderProduct", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Product", "_product")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ProductID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ElectronicsShopDataBaseImplement.Models.Order", "_order")
|
|
||||||
.WithMany("Products")
|
|
||||||
.HasForeignKey("_orderID")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("_order");
|
|
||||||
|
|
||||||
b.Navigation("_product");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ElectronicsShopDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Products");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,175 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Migration02 : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
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<int>(
|
|
||||||
name: "_productID",
|
|
||||||
table: "OrderProducts",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Paymeants",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ID = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
ProductID = table.Column<int>(type: "int", nullable: false),
|
|
||||||
OrderID = table.Column<int>(type: "int", nullable: false),
|
|
||||||
SumPayment = table.Column<double>(type: "float", nullable: false),
|
|
||||||
PayOption = table.Column<int>(type: "int", nullable: false),
|
|
||||||
PaymentID = table.Column<int>(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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
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<int>(
|
|
||||||
name: "EmployeeID",
|
|
||||||
table: "Orders",
|
|
||||||
type: "int",
|
|
||||||
nullable: true);
|
|
||||||
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(Database))]
|
[DbContext(typeof(Database))]
|
||||||
[Migration("20240526155227_Migration02")]
|
[Migration("20240527144429_test")]
|
||||||
partial class Migration02
|
partial class test
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||||||
namespace ElectronicsShopDataBaseImplement.Migrations
|
namespace ElectronicsShopDataBaseImplement.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class InitMigration : Migration
|
public partial class test : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
@ -56,22 +56,6 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
table.PrimaryKey("PK_Employees", x => x.ID);
|
table.PrimaryKey("PK_Employees", x => x.ID);
|
||||||
});
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Orders",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
ID = table.Column<int>(type: "int", nullable: false)
|
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
|
||||||
Sum = table.Column<double>(type: "float", nullable: false),
|
|
||||||
ClientID = table.Column<int>(type: "int", nullable: false),
|
|
||||||
EmployeeID = table.Column<int>(type: "int", nullable: true),
|
|
||||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Orders", x => x.ID);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Products",
|
name: "Products",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@ -87,51 +71,100 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
table.PrimaryKey("PK_Products", x => x.ID);
|
table.PrimaryKey("PK_Products", x => x.ID);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Orders",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
Sum = table.Column<double>(type: "float", nullable: false),
|
||||||
|
ClientID = table.Column<int>(type: "int", nullable: false),
|
||||||
|
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Orders", x => x.ID);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientID",
|
||||||
|
column: x => x.ClientID,
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "ID",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "OrderProducts",
|
name: "OrderProducts",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
{
|
{
|
||||||
Id = table.Column<int>(type: "int", nullable: false)
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
.Annotation("SqlServer:Identity", "1, 1"),
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
OrdersID = table.Column<int>(type: "int", nullable: false),
|
OrderID = table.Column<int>(type: "int", nullable: false),
|
||||||
ProductID = table.Column<int>(type: "int", nullable: false),
|
ProductID = table.Column<int>(type: "int", nullable: false),
|
||||||
Count = table.Column<int>(type: "int", nullable: false),
|
Count = table.Column<int>(type: "int", nullable: false),
|
||||||
_orderID = table.Column<int>(type: "int", nullable: false)
|
_productID = table.Column<int>(type: "int", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
table.PrimaryKey("PK_OrderProducts", x => x.Id);
|
table.PrimaryKey("PK_OrderProducts", x => x.Id);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_OrderProducts_Orders__orderID",
|
name: "FK_OrderProducts_Orders_ProductID",
|
||||||
column: x => x._orderID,
|
column: x => x.ProductID,
|
||||||
principalTable: "Orders",
|
principalTable: "Orders",
|
||||||
principalColumn: "ID",
|
principalColumn: "ID",
|
||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
table.ForeignKey(
|
table.ForeignKey(
|
||||||
name: "FK_OrderProducts_Products_ProductID",
|
name: "FK_OrderProducts_Products__productID",
|
||||||
column: x => x.ProductID,
|
column: x => x._productID,
|
||||||
principalTable: "Products",
|
principalTable: "Products",
|
||||||
principalColumn: "ID",
|
principalColumn: "ID");
|
||||||
onDelete: ReferentialAction.Cascade);
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Paymeants",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
ID = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ProductID = table.Column<int>(type: "int", nullable: false),
|
||||||
|
OrderID = table.Column<int>(type: "int", nullable: false),
|
||||||
|
SumPayment = table.Column<double>(type: "float", nullable: false),
|
||||||
|
PayOption = table.Column<int>(type: "int", nullable: false),
|
||||||
|
PaymentID = table.Column<int>(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(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_OrderProducts__orderID",
|
name: "IX_OrderProducts__productID",
|
||||||
table: "OrderProducts",
|
table: "OrderProducts",
|
||||||
column: "_orderID");
|
column: "_productID");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_OrderProducts_ProductID",
|
name: "IX_OrderProducts_ProductID",
|
||||||
table: "OrderProducts",
|
table: "OrderProducts",
|
||||||
column: "ProductID");
|
column: "ProductID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ClientID",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientID");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Paymeants_PaymentID",
|
||||||
|
table: "Paymeants",
|
||||||
|
column: "PaymentID");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Clients");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "CostItems");
|
name: "CostItems");
|
||||||
|
|
||||||
@ -142,10 +175,16 @@ namespace ElectronicsShopDataBaseImplement.Migrations
|
|||||||
name: "OrderProducts");
|
name: "OrderProducts");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Orders");
|
name: "Paymeants");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Products");
|
name: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Clients");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -64,7 +64,7 @@ namespace ElectronicsShopUserApp.Controllers {
|
|||||||
if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) {
|
if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) {
|
||||||
throw new Exception("Ââåäèòå ïî÷òó è ïàðîëü");
|
throw new Exception("Ââåäèòå ïî÷òó è ïàðîëü");
|
||||||
}
|
}
|
||||||
APIClient.Client = APIClient.GetRequset<ClientViewModel>($"api/client/email?email={email}&password={password}");
|
APIClient.Client = APIClient.GetRequset<ClientViewModel>($"api/Client/Login?email={email}&password={password}");
|
||||||
if (APIClient.Client == null) {
|
if (APIClient.Client == null) {
|
||||||
throw new Exception("Íåâåðíûé àäðåñ ïî÷òû/ïàðîëü");
|
throw new Exception("Íåâåðíûé àäðåñ ïî÷òû/ïàðîëü");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user