From 9201113e0d8c1dd34f68494f7dc68dde8aeb7d9e Mon Sep 17 00:00:00 2001 From: abazov73 <92822431+abazov73@users.noreply.github.com> Date: Fri, 7 Apr 2023 18:04:25 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B8=D0=B3=D1=80=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8F=20=D0=91=D0=94=20+=20=D0=BD=D0=B5=D0=B1=D0=BE=D0=BB?= =?UTF-8?q?=D1=8C=D1=88=D0=BE=D0=B9=20=D1=84=D0=B8=D0=BA=D1=81=20HomeContr?= =?UTF-8?q?oller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230407133918_InitialCreate.Designer.cs | 480 ++++++++++++++++++ .../20230407133918_InitialCreate.cs | 383 ++++++++++++++ .../Migrations/BankDatabaseModelSnapshot.cs | 477 +++++++++++++++++ .../OperatorApp/Controllers/HomeController.cs | 2 +- Bank/OperatorApp/OperatorApp.csproj | 5 + Bank/OperatorApp/Program.cs | 4 + 6 files changed, 1350 insertions(+), 1 deletion(-) create mode 100644 Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.Designer.cs create mode 100644 Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.cs create mode 100644 Bank/BankDatabaseImplement/Migrations/BankDatabaseModelSnapshot.cs diff --git a/Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.Designer.cs b/Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.Designer.cs new file mode 100644 index 0000000..9ac14ed --- /dev/null +++ b/Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.Designer.cs @@ -0,0 +1,480 @@ +// +using System; +using BankDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace BankDatabaseImplement.Migrations +{ + [DbContext(typeof(BankDatabase))] + [Migration("20230407133918_InitialCreate")] + partial class InitialCreate + { + /// + 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("BankDatabaseImplement.Models.BankOperator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MiddleName") + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("BankOperators"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BankOperatorId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Percent") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("BankOperatorId"); + + b.ToTable("CreditPrograms"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreditProgramId") + .HasColumnType("int"); + + b.Property("CurrencyId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreditProgramId"); + + b.HasIndex("CurrencyId"); + + b.ToTable("CreditProgramCurrencies"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BankOperatorId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BankOperatorId"); + + b.ToTable("Currencies"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CurrencyId") + .HasColumnType("int"); + + b.Property("PaymentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("PaymentId"); + + b.ToTable("CurrencyPayments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("real"); + + b.Property("BankOperatorId") + .HasColumnType("int"); + + b.Property("CurrencyId") + .HasColumnType("int"); + + b.Property("PurchaseDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("BankOperatorId"); + + b.HasIndex("CurrencyId"); + + b.ToTable("CurrencyPurchases"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("CreditProgramId") + .HasColumnType("int"); + + b.Property("DealDate") + .HasColumnType("datetime2"); + + b.Property("OperatorId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreditProgramId"); + + b.HasIndex("OperatorId"); + + b.ToTable("Deals"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DealId") + .HasColumnType("int"); + + b.Property("PaymentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DealId"); + + b.HasIndex("PaymentId"); + + b.ToTable("DealPayments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Operator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MiddleName") + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Operators"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("OperatorId") + .HasColumnType("int"); + + b.Property("PaymentDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OperatorId"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("real"); + + b.Property("OperatorId") + .HasColumnType("int"); + + b.Property("PaymentId") + .HasColumnType("int"); + + b.Property("TransferDateTime") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OperatorId"); + + b.HasIndex("PaymentId"); + + b.ToTable("Transfers"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b => + { + b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator") + .WithMany() + .HasForeignKey("BankOperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BankOperator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b => + { + b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram") + .WithMany("Currencies") + .HasForeignKey("CreditProgramId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreditProgram"); + + b.Navigation("Currency"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b => + { + b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator") + .WithMany() + .HasForeignKey("BankOperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BankOperator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b => + { + b.HasOne("BankDatabaseImplement.Models.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Payment", "Payment") + .WithMany("Currencies") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Currency"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b => + { + b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator") + .WithMany() + .HasForeignKey("BankOperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BankOperator"); + + b.Navigation("Currency"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b => + { + b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram") + .WithMany() + .HasForeignKey("CreditProgramId"); + + b.HasOne("BankDatabaseImplement.Models.Operator", "Operator") + .WithMany() + .HasForeignKey("OperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreditProgram"); + + b.Navigation("Operator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b => + { + b.HasOne("BankDatabaseImplement.Models.Deal", "Deal") + .WithMany("DealPayments") + .HasForeignKey("DealId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Payment", "Payment") + .WithMany("Deals") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Deal"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b => + { + b.HasOne("BankDatabaseImplement.Models.Operator", "Operator") + .WithMany() + .HasForeignKey("OperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Operator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b => + { + b.HasOne("BankDatabaseImplement.Models.Operator", "Operator") + .WithMany() + .HasForeignKey("OperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Operator"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b => + { + b.Navigation("Currencies"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b => + { + b.Navigation("DealPayments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b => + { + b.Navigation("Currencies"); + + b.Navigation("Deals"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.cs b/Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.cs new file mode 100644 index 0000000..6d6cad4 --- /dev/null +++ b/Bank/BankDatabaseImplement/Migrations/20230407133918_InitialCreate.cs @@ -0,0 +1,383 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace BankDatabaseImplement.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "BankOperators", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Login = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false), + FirstName = table.Column(type: "nvarchar(max)", nullable: false), + LastName = table.Column(type: "nvarchar(max)", nullable: false), + MiddleName = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_BankOperators", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Operators", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Login = table.Column(type: "nvarchar(max)", nullable: false), + Password = table.Column(type: "nvarchar(max)", nullable: false), + LastName = table.Column(type: "nvarchar(max)", nullable: false), + FirstName = table.Column(type: "nvarchar(max)", nullable: false), + MiddleName = table.Column(type: "nvarchar(max)", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Operators", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CreditPrograms", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Percent = table.Column(type: "real", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + BankOperatorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CreditPrograms", x => x.Id); + table.ForeignKey( + name: "FK_CreditPrograms_BankOperators_BankOperatorId", + column: x => x.BankOperatorId, + principalTable: "BankOperators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Currencies", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(max)", nullable: false), + BankOperatorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Currencies", x => x.Id); + table.ForeignKey( + name: "FK_Currencies_BankOperators_BankOperatorId", + column: x => x.BankOperatorId, + principalTable: "BankOperators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Payments", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PaymentDate = table.Column(type: "datetime2", nullable: false), + OperatorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Payments", x => x.Id); + table.ForeignKey( + name: "FK_Payments_Operators_OperatorId", + column: x => x.OperatorId, + principalTable: "Operators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Deals", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + ClientId = table.Column(type: "int", nullable: false), + DealDate = table.Column(type: "datetime2", nullable: false), + OperatorId = table.Column(type: "int", nullable: false), + CreditProgramId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Deals", x => x.Id); + table.ForeignKey( + name: "FK_Deals_CreditPrograms_CreditProgramId", + column: x => x.CreditProgramId, + principalTable: "CreditPrograms", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Deals_Operators_OperatorId", + column: x => x.OperatorId, + principalTable: "Operators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "CreditProgramCurrencies", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CurrencyId = table.Column(type: "int", nullable: false), + CreditProgramId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CreditProgramCurrencies", x => x.Id); + table.ForeignKey( + name: "FK_CreditProgramCurrencies_CreditPrograms_CreditProgramId", + column: x => x.CreditProgramId, + principalTable: "CreditPrograms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CreditProgramCurrencies_Currencies_CurrencyId", + column: x => x.CurrencyId, + principalTable: "Currencies", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CurrencyPurchases", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Amount = table.Column(type: "real", nullable: false), + PurchaseDate = table.Column(type: "datetime2", nullable: false), + BankOperatorId = table.Column(type: "int", nullable: false), + CurrencyId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CurrencyPurchases", x => x.Id); + table.ForeignKey( + name: "FK_CurrencyPurchases_BankOperators_BankOperatorId", + column: x => x.BankOperatorId, + principalTable: "BankOperators", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CurrencyPurchases_Currencies_CurrencyId", + column: x => x.CurrencyId, + principalTable: "Currencies", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CurrencyPayments", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + CurrencyId = table.Column(type: "int", nullable: false), + PaymentId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CurrencyPayments", x => x.Id); + table.ForeignKey( + name: "FK_CurrencyPayments_Currencies_CurrencyId", + column: x => x.CurrencyId, + principalTable: "Currencies", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CurrencyPayments_Payments_PaymentId", + column: x => x.PaymentId, + principalTable: "Payments", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Transfers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Amount = table.Column(type: "real", nullable: false), + TransferDateTime = table.Column(type: "datetime2", nullable: false), + PaymentId = table.Column(type: "int", nullable: false), + OperatorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Transfers", x => x.Id); + table.ForeignKey( + name: "FK_Transfers_Operators_OperatorId", + column: x => x.OperatorId, + principalTable: "Operators", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Transfers_Payments_PaymentId", + column: x => x.PaymentId, + principalTable: "Payments", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "DealPayments", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + DealId = table.Column(type: "int", nullable: false), + PaymentId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DealPayments", x => x.Id); + table.ForeignKey( + name: "FK_DealPayments_Deals_DealId", + column: x => x.DealId, + principalTable: "Deals", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + table.ForeignKey( + name: "FK_DealPayments_Payments_PaymentId", + column: x => x.PaymentId, + principalTable: "Payments", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + }); + + migrationBuilder.CreateIndex( + name: "IX_CreditProgramCurrencies_CreditProgramId", + table: "CreditProgramCurrencies", + column: "CreditProgramId"); + + migrationBuilder.CreateIndex( + name: "IX_CreditProgramCurrencies_CurrencyId", + table: "CreditProgramCurrencies", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_CreditPrograms_BankOperatorId", + table: "CreditPrograms", + column: "BankOperatorId"); + + migrationBuilder.CreateIndex( + name: "IX_Currencies_BankOperatorId", + table: "Currencies", + column: "BankOperatorId"); + + migrationBuilder.CreateIndex( + name: "IX_CurrencyPayments_CurrencyId", + table: "CurrencyPayments", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_CurrencyPayments_PaymentId", + table: "CurrencyPayments", + column: "PaymentId"); + + migrationBuilder.CreateIndex( + name: "IX_CurrencyPurchases_BankOperatorId", + table: "CurrencyPurchases", + column: "BankOperatorId"); + + migrationBuilder.CreateIndex( + name: "IX_CurrencyPurchases_CurrencyId", + table: "CurrencyPurchases", + column: "CurrencyId"); + + migrationBuilder.CreateIndex( + name: "IX_DealPayments_DealId", + table: "DealPayments", + column: "DealId"); + + migrationBuilder.CreateIndex( + name: "IX_DealPayments_PaymentId", + table: "DealPayments", + column: "PaymentId"); + + migrationBuilder.CreateIndex( + name: "IX_Deals_CreditProgramId", + table: "Deals", + column: "CreditProgramId"); + + migrationBuilder.CreateIndex( + name: "IX_Deals_OperatorId", + table: "Deals", + column: "OperatorId"); + + migrationBuilder.CreateIndex( + name: "IX_Payments_OperatorId", + table: "Payments", + column: "OperatorId"); + + migrationBuilder.CreateIndex( + name: "IX_Transfers_OperatorId", + table: "Transfers", + column: "OperatorId"); + + migrationBuilder.CreateIndex( + name: "IX_Transfers_PaymentId", + table: "Transfers", + column: "PaymentId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CreditProgramCurrencies"); + + migrationBuilder.DropTable( + name: "CurrencyPayments"); + + migrationBuilder.DropTable( + name: "CurrencyPurchases"); + + migrationBuilder.DropTable( + name: "DealPayments"); + + migrationBuilder.DropTable( + name: "Transfers"); + + migrationBuilder.DropTable( + name: "Currencies"); + + migrationBuilder.DropTable( + name: "Deals"); + + migrationBuilder.DropTable( + name: "Payments"); + + migrationBuilder.DropTable( + name: "CreditPrograms"); + + migrationBuilder.DropTable( + name: "Operators"); + + migrationBuilder.DropTable( + name: "BankOperators"); + } + } +} diff --git a/Bank/BankDatabaseImplement/Migrations/BankDatabaseModelSnapshot.cs b/Bank/BankDatabaseImplement/Migrations/BankDatabaseModelSnapshot.cs new file mode 100644 index 0000000..c8f37a3 --- /dev/null +++ b/Bank/BankDatabaseImplement/Migrations/BankDatabaseModelSnapshot.cs @@ -0,0 +1,477 @@ +// +using System; +using BankDatabaseImplement; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace BankDatabaseImplement.Migrations +{ + [DbContext(typeof(BankDatabase))] + partial class BankDatabaseModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("BankDatabaseImplement.Models.BankOperator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MiddleName") + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("BankOperators"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BankOperatorId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Percent") + .HasColumnType("real"); + + b.HasKey("Id"); + + b.HasIndex("BankOperatorId"); + + b.ToTable("CreditPrograms"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreditProgramId") + .HasColumnType("int"); + + b.Property("CurrencyId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreditProgramId"); + + b.HasIndex("CurrencyId"); + + b.ToTable("CreditProgramCurrencies"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BankOperatorId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("BankOperatorId"); + + b.ToTable("Currencies"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CurrencyId") + .HasColumnType("int"); + + b.Property("PaymentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CurrencyId"); + + b.HasIndex("PaymentId"); + + b.ToTable("CurrencyPayments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("real"); + + b.Property("BankOperatorId") + .HasColumnType("int"); + + b.Property("CurrencyId") + .HasColumnType("int"); + + b.Property("PurchaseDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("BankOperatorId"); + + b.HasIndex("CurrencyId"); + + b.ToTable("CurrencyPurchases"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClientId") + .HasColumnType("int"); + + b.Property("CreditProgramId") + .HasColumnType("int"); + + b.Property("DealDate") + .HasColumnType("datetime2"); + + b.Property("OperatorId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreditProgramId"); + + b.HasIndex("OperatorId"); + + b.ToTable("Deals"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DealId") + .HasColumnType("int"); + + b.Property("PaymentId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DealId"); + + b.HasIndex("PaymentId"); + + b.ToTable("DealPayments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Operator", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Login") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MiddleName") + .HasColumnType("nvarchar(max)"); + + b.Property("Password") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Operators"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("OperatorId") + .HasColumnType("int"); + + b.Property("PaymentDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OperatorId"); + + b.ToTable("Payments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Amount") + .HasColumnType("real"); + + b.Property("OperatorId") + .HasColumnType("int"); + + b.Property("PaymentId") + .HasColumnType("int"); + + b.Property("TransferDateTime") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("OperatorId"); + + b.HasIndex("PaymentId"); + + b.ToTable("Transfers"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b => + { + b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator") + .WithMany() + .HasForeignKey("BankOperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BankOperator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b => + { + b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram") + .WithMany("Currencies") + .HasForeignKey("CreditProgramId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreditProgram"); + + b.Navigation("Currency"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b => + { + b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator") + .WithMany() + .HasForeignKey("BankOperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BankOperator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b => + { + b.HasOne("BankDatabaseImplement.Models.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Payment", "Payment") + .WithMany("Currencies") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Currency"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b => + { + b.HasOne("BankDatabaseImplement.Models.BankOperator", "BankOperator") + .WithMany() + .HasForeignKey("BankOperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Currency", "Currency") + .WithMany() + .HasForeignKey("CurrencyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BankOperator"); + + b.Navigation("Currency"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b => + { + b.HasOne("BankDatabaseImplement.Models.CreditProgram", "CreditProgram") + .WithMany() + .HasForeignKey("CreditProgramId"); + + b.HasOne("BankDatabaseImplement.Models.Operator", "Operator") + .WithMany() + .HasForeignKey("OperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreditProgram"); + + b.Navigation("Operator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b => + { + b.HasOne("BankDatabaseImplement.Models.Deal", "Deal") + .WithMany("DealPayments") + .HasForeignKey("DealId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Payment", "Payment") + .WithMany("Deals") + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Deal"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b => + { + b.HasOne("BankDatabaseImplement.Models.Operator", "Operator") + .WithMany() + .HasForeignKey("OperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Operator"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b => + { + b.HasOne("BankDatabaseImplement.Models.Operator", "Operator") + .WithMany() + .HasForeignKey("OperatorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("BankDatabaseImplement.Models.Payment", "Payment") + .WithMany() + .HasForeignKey("PaymentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Operator"); + + b.Navigation("Payment"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b => + { + b.Navigation("Currencies"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b => + { + b.Navigation("DealPayments"); + }); + + modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b => + { + b.Navigation("Currencies"); + + b.Navigation("Deals"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Bank/OperatorApp/Controllers/HomeController.cs b/Bank/OperatorApp/Controllers/HomeController.cs index 9d6500b..ede4c06 100644 --- a/Bank/OperatorApp/Controllers/HomeController.cs +++ b/Bank/OperatorApp/Controllers/HomeController.cs @@ -103,7 +103,7 @@ namespace OperatorApp.Controllers { throw new Exception("Введите логин, пароль и ФИО"); } - APIClient.PostRequest("api/operator/createOperator", new OperatorBindingModel + APIClient.PostRequest("api/operator/createoperator", new OperatorBindingModel { LastName = lastname, FirstName = firstname, diff --git a/Bank/OperatorApp/OperatorApp.csproj b/Bank/OperatorApp/OperatorApp.csproj index b5167a1..7a0c33a 100644 --- a/Bank/OperatorApp/OperatorApp.csproj +++ b/Bank/OperatorApp/OperatorApp.csproj @@ -7,11 +7,16 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/Bank/OperatorApp/Program.cs b/Bank/OperatorApp/Program.cs index 0727468..28fea40 100644 --- a/Bank/OperatorApp/Program.cs +++ b/Bank/OperatorApp/Program.cs @@ -1,3 +1,5 @@ +using OperatorApp; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -5,6 +7,8 @@ builder.Services.AddControllersWithViews(); var app = builder.Build(); +APIClient.Connect(builder.Configuration); + // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) {