diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230401180945_InitMagration.Designer.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230401180945_InitMagration.Designer.cs
new file mode 100644
index 0000000..18326b0
--- /dev/null
+++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230401180945_InitMagration.Designer.cs
@@ -0,0 +1,386 @@
+//
+using System;
+using BankYouBankruptDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace BankYouBankruptDatabaseImplement.Migrations
+{
+ [DbContext(typeof(BankYouBancruptDatabase))]
+ [Migration("20230401180945_InitMagration")]
+ partial class InitMagration
+ {
+ ///
+ 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("BankYouBankruptDatabaseImplement.Models.Account", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountNumber")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Balance")
+ .HasColumnType("float");
+
+ b.Property("CashierId")
+ .HasColumnType("int");
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("DateOpen")
+ .HasColumnType("datetime2");
+
+ b.Property("PasswordAccount")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CashierId");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("Accounts");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountId")
+ .HasColumnType("int");
+
+ b.Property("CVC")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClientID")
+ .HasColumnType("int");
+
+ b.Property("Number")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Period")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountId");
+
+ b.HasIndex("ClientID");
+
+ b.ToTable("Cards");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountId")
+ .HasColumnType("int");
+
+ b.Property("DateOperation")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountId");
+
+ b.ToTable("CashWithdrawals");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Patronymic")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Surname")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Telephone")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Cashiers");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Patronymic")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Surname")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Telephone")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Clients");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CardId")
+ .HasColumnType("int");
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CardId");
+
+ b.ToTable("Creditings");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CardId")
+ .HasColumnType("int");
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CardId");
+
+ b.ToTable("Debitings");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountPayeeId")
+ .HasColumnType("int");
+
+ b.Property("AccountSenderId")
+ .HasColumnType("int");
+
+ b.Property("DateOperation")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountPayeeId");
+
+ b.HasIndex("AccountSenderId");
+
+ b.ToTable("MoneyTransfers");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", null)
+ .WithMany("Accounts")
+ .HasForeignKey("CashierId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Client", "Client")
+ .WithMany()
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", null)
+ .WithMany("Cards")
+ .HasForeignKey("AccountId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Client", "Client")
+ .WithMany("Cards")
+ .HasForeignKey("ClientID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", "Account")
+ .WithMany("CashWithdrawals")
+ .HasForeignKey("AccountId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Account");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Card", "Card")
+ .WithMany("Creditings")
+ .HasForeignKey("CardId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Card");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Card", "Card")
+ .WithMany("Debitings")
+ .HasForeignKey("CardId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Card");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", null)
+ .WithMany("MoneyTransferPayees")
+ .HasForeignKey("AccountPayeeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", null)
+ .WithMany("MoneyTransferSenders")
+ .HasForeignKey("AccountSenderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
+ {
+ b.Navigation("Cards");
+
+ b.Navigation("CashWithdrawals");
+
+ b.Navigation("MoneyTransferPayees");
+
+ b.Navigation("MoneyTransferSenders");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
+ {
+ b.Navigation("Creditings");
+
+ b.Navigation("Debitings");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
+ {
+ b.Navigation("Accounts");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Cards");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230401180945_InitMagration.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230401180945_InitMagration.cs
new file mode 100644
index 0000000..baeb448
--- /dev/null
+++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230401180945_InitMagration.cs
@@ -0,0 +1,274 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace BankYouBankruptDatabaseImplement.Migrations
+{
+ ///
+ public partial class InitMagration : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.CreateTable(
+ name: "Cashiers",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Password = table.Column(type: "nvarchar(max)", nullable: false),
+ Name = table.Column(type: "nvarchar(max)", nullable: false),
+ Surname = table.Column(type: "nvarchar(max)", nullable: false),
+ Patronymic = table.Column(type: "nvarchar(max)", nullable: false),
+ Email = table.Column(type: "nvarchar(max)", nullable: false),
+ Telephone = table.Column(type: "nvarchar(max)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Cashiers", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Clients",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Name = table.Column(type: "nvarchar(max)", nullable: false),
+ Surname = table.Column(type: "nvarchar(max)", nullable: false),
+ Patronymic = table.Column(type: "nvarchar(max)", nullable: false),
+ Telephone = 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.CreateTable(
+ name: "Accounts",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ AccountNumber = table.Column(type: "nvarchar(max)", nullable: false),
+ CashierId = table.Column(type: "int", nullable: false),
+ ClientId = table.Column(type: "int", nullable: false),
+ PasswordAccount = table.Column(type: "nvarchar(max)", nullable: false),
+ Balance = table.Column(type: "float", nullable: false),
+ DateOpen = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Accounts", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Accounts_Cashiers_CashierId",
+ column: x => x.CashierId,
+ principalTable: "Cashiers",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Accounts_Clients_ClientId",
+ column: x => x.ClientId,
+ principalTable: "Clients",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Cards",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ ClientID = table.Column(type: "int", nullable: false),
+ AccountId = table.Column(type: "int", nullable: false),
+ Number = table.Column(type: "nvarchar(max)", nullable: false),
+ CVC = table.Column(type: "nvarchar(max)", nullable: false),
+ Period = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Cards", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Cards_Accounts_AccountId",
+ column: x => x.AccountId,
+ principalTable: "Accounts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Cards_Clients_ClientID",
+ column: x => x.ClientID,
+ principalTable: "Clients",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.NoAction);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "CashWithdrawals",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ AccountId = table.Column(type: "int", nullable: false),
+ Sum = table.Column(type: "int", nullable: false),
+ DateOperation = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_CashWithdrawals", x => x.Id);
+ table.ForeignKey(
+ name: "FK_CashWithdrawals_Accounts_AccountId",
+ column: x => x.AccountId,
+ principalTable: "Accounts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "MoneyTransfers",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ Sum = table.Column(type: "int", nullable: false),
+ AccountSenderId = table.Column(type: "int", nullable: false),
+ AccountPayeeId = table.Column(type: "int", nullable: false),
+ DateOperation = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_MoneyTransfers", x => x.Id);
+ table.ForeignKey(
+ name: "FK_MoneyTransfers_Accounts_AccountPayeeId",
+ column: x => x.AccountPayeeId,
+ principalTable: "Accounts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_MoneyTransfers_Accounts_AccountSenderId",
+ column: x => x.AccountSenderId,
+ principalTable: "Accounts",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.NoAction);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Creditings",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ CardId = table.Column(type: "int", nullable: false),
+ Sum = table.Column(type: "int", nullable: false),
+ Date = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Creditings", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Creditings_Cards_CardId",
+ column: x => x.CardId,
+ principalTable: "Cards",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Debitings",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("SqlServer:Identity", "1, 1"),
+ CardId = table.Column(type: "int", nullable: false),
+ Sum = table.Column(type: "int", nullable: false),
+ Date = table.Column(type: "datetime2", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Debitings", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Debitings_Cards_CardId",
+ column: x => x.CardId,
+ principalTable: "Cards",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Accounts_CashierId",
+ table: "Accounts",
+ column: "CashierId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Accounts_ClientId",
+ table: "Accounts",
+ column: "ClientId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Cards_AccountId",
+ table: "Cards",
+ column: "AccountId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Cards_ClientID",
+ table: "Cards",
+ column: "ClientID");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_CashWithdrawals_AccountId",
+ table: "CashWithdrawals",
+ column: "AccountId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Creditings_CardId",
+ table: "Creditings",
+ column: "CardId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Debitings_CardId",
+ table: "Debitings",
+ column: "CardId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_MoneyTransfers_AccountPayeeId",
+ table: "MoneyTransfers",
+ column: "AccountPayeeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_MoneyTransfers_AccountSenderId",
+ table: "MoneyTransfers",
+ column: "AccountSenderId");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropTable(
+ name: "CashWithdrawals");
+
+ migrationBuilder.DropTable(
+ name: "Creditings");
+
+ migrationBuilder.DropTable(
+ name: "Debitings");
+
+ migrationBuilder.DropTable(
+ name: "MoneyTransfers");
+
+ migrationBuilder.DropTable(
+ name: "Cards");
+
+ migrationBuilder.DropTable(
+ name: "Accounts");
+
+ migrationBuilder.DropTable(
+ name: "Cashiers");
+
+ migrationBuilder.DropTable(
+ name: "Clients");
+ }
+ }
+}
diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/BankYouBancruptDatabaseModelSnapshot.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/BankYouBancruptDatabaseModelSnapshot.cs
new file mode 100644
index 0000000..054bbd7
--- /dev/null
+++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/BankYouBancruptDatabaseModelSnapshot.cs
@@ -0,0 +1,383 @@
+//
+using System;
+using BankYouBankruptDatabaseImplement;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace BankYouBankruptDatabaseImplement.Migrations
+{
+ [DbContext(typeof(BankYouBancruptDatabase))]
+ partial class BankYouBancruptDatabaseModelSnapshot : 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("BankYouBankruptDatabaseImplement.Models.Account", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountNumber")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Balance")
+ .HasColumnType("float");
+
+ b.Property("CashierId")
+ .HasColumnType("int");
+
+ b.Property("ClientId")
+ .HasColumnType("int");
+
+ b.Property("DateOpen")
+ .HasColumnType("datetime2");
+
+ b.Property("PasswordAccount")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CashierId");
+
+ b.HasIndex("ClientId");
+
+ b.ToTable("Accounts");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountId")
+ .HasColumnType("int");
+
+ b.Property("CVC")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ClientID")
+ .HasColumnType("int");
+
+ b.Property("Number")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Period")
+ .HasColumnType("datetime2");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountId");
+
+ b.HasIndex("ClientID");
+
+ b.ToTable("Cards");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountId")
+ .HasColumnType("int");
+
+ b.Property("DateOperation")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountId");
+
+ b.ToTable("CashWithdrawals");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Patronymic")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Surname")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Telephone")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Cashiers");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Patronymic")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Surname")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Telephone")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Clients");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CardId")
+ .HasColumnType("int");
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CardId");
+
+ b.ToTable("Creditings");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("CardId")
+ .HasColumnType("int");
+
+ b.Property("Date")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CardId");
+
+ b.ToTable("Debitings");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
+
+ b.Property("AccountPayeeId")
+ .HasColumnType("int");
+
+ b.Property("AccountSenderId")
+ .HasColumnType("int");
+
+ b.Property("DateOperation")
+ .HasColumnType("datetime2");
+
+ b.Property("Sum")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountPayeeId");
+
+ b.HasIndex("AccountSenderId");
+
+ b.ToTable("MoneyTransfers");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", null)
+ .WithMany("Accounts")
+ .HasForeignKey("CashierId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Client", "Client")
+ .WithMany()
+ .HasForeignKey("ClientId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", null)
+ .WithMany("Cards")
+ .HasForeignKey("AccountId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Client", "Client")
+ .WithMany("Cards")
+ .HasForeignKey("ClientID")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Client");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", "Account")
+ .WithMany("CashWithdrawals")
+ .HasForeignKey("AccountId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Account");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Card", "Card")
+ .WithMany("Creditings")
+ .HasForeignKey("CardId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Card");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Card", "Card")
+ .WithMany("Debitings")
+ .HasForeignKey("CardId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Card");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b =>
+ {
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", null)
+ .WithMany("MoneyTransferPayees")
+ .HasForeignKey("AccountPayeeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", null)
+ .WithMany("MoneyTransferSenders")
+ .HasForeignKey("AccountSenderId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
+ {
+ b.Navigation("Cards");
+
+ b.Navigation("CashWithdrawals");
+
+ b.Navigation("MoneyTransferPayees");
+
+ b.Navigation("MoneyTransferSenders");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
+ {
+ b.Navigation("Creditings");
+
+ b.Navigation("Debitings");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
+ {
+ b.Navigation("Accounts");
+ });
+
+ modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
+ {
+ b.Navigation("Cards");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs
index f1b54da..8194ca3 100644
--- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs
+++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Card.cs
@@ -14,15 +14,21 @@ namespace BankYouBankruptDatabaseImplement.Models
public class Card : ICardModel
{
public int Id { get; set; }
+
[Required]
public int ClientID { get; set; }
+
public virtual Client Client { get; set; } = new();
+
[Required]
public int AccountId { get; set; }
+
[Required]
public string Number { get; set; } = String.Empty;
+
[Required]
public string CVC { get; set; }
+
[Required]
public DateTime Period { get; set; } = DateTime.Now;
diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs
index 0ff716e..2d48d21 100644
--- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs
+++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Client.cs
@@ -34,7 +34,7 @@ namespace BankYouBankruptDatabaseImplement.Models
public string Password { get; set; } = string.Empty;
[ForeignKey("ClientID")]
- public virtual List Clients { get; set; } = new();
+ public virtual List Cards { get; set; } = new();
public ClientViewModel GetViewModel => new()
{
diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs
index 9c8930d..c7aec11 100644
--- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs
+++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/MoneyTransfer.cs
@@ -21,15 +21,9 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required]
public int AccountSenderId { get; set; }
- //для передачи номера счёта отправителя
- //public virtual Account AccountSender { get; set; }
-
[Required]
public int AccountPayeeId { get; set; }
- //для передачи номера счёта получателя
- //public virtual Account AccountPayee { get; set; }
-
[Required]
public DateTime DateOperation { get; set; }
@@ -41,9 +35,7 @@ namespace BankYouBankruptDatabaseImplement.Models
Sum = model.Sum,
AccountSenderId = model.AccountSenderId,
AccountPayeeId = model.AccountPayeeId,
- DateOperation = model.DateOperation,
- //AccountSender = context.Accounts.First(x => x.Id == model.AccountSenderId),
- //AccountPayee = context.Accounts.First(x => x.Id == model.AccountPayeeId)
+ DateOperation = model.DateOperation
};
}