New Database.
This commit is contained in:
parent
1c4a012f7f
commit
d595f076ed
@ -0,0 +1,449 @@
|
||||
// <auto-generated />
|
||||
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("20230516171124_NewTransferAndCrediting")]
|
||||
partial class NewTransferAndCrediting
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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("BankYouBankruptDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Balance")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CVC")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClientID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("Period")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("ClientID");
|
||||
|
||||
b.ToTable("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOperation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DebitingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("DebitingId");
|
||||
|
||||
b.ToTable("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cashiers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateClose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Creditings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateClose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountPayeeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AccountPayeerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("AccountSenderId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("CreditingId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOperation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountPayeerId");
|
||||
|
||||
b.HasIndex("AccountSenderId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
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.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||
.WithMany("CashWithdrawals")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Debiting", "Debiting")
|
||||
.WithMany()
|
||||
.HasForeignKey("DebitingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
|
||||
b.Navigation("Debiting");
|
||||
});
|
||||
|
||||
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", "AccountPayeer")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountPayeerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", "AccountSender")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountSenderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||
.WithMany("MoneyTransfers")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AccountPayeer");
|
||||
|
||||
b.Navigation("AccountSender");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Navigation("Creditings");
|
||||
|
||||
b.Navigation("Debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
|
||||
b.Navigation("MoneyTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,316 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BankYouBankruptDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class NewTransferAndCrediting : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Cashiers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Surname = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Patronymic = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Telephone = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Cashiers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Clients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Surname = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Patronymic = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Telephone = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Clients", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Accounts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
AccountNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CashierId = table.Column<int>(type: "int", nullable: false),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
PasswordAccount = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Balance = table.Column<double>(type: "float", nullable: false),
|
||||
DateOpen = table.Column<DateTime>(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<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
ClientID = table.Column<int>(type: "int", nullable: false),
|
||||
AccountId = table.Column<int>(type: "int", nullable: false),
|
||||
Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CVC = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Period = table.Column<DateTime>(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: "MoneyTransfers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Sum = table.Column<int>(type: "int", nullable: false),
|
||||
AccountSenderId = table.Column<int>(type: "int", nullable: false),
|
||||
AccountPayeeId = table.Column<int>(type: "int", nullable: false),
|
||||
DateOperation = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreditingId = table.Column<int>(type: "int", nullable: false),
|
||||
CashierId = table.Column<int>(type: "int", nullable: false),
|
||||
AccountPayeerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MoneyTransfers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_MoneyTransfers_Accounts_AccountPayeerId",
|
||||
column: x => x.AccountPayeerId,
|
||||
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);
|
||||
table.ForeignKey(
|
||||
name: "FK_MoneyTransfers_Cashiers_CashierId",
|
||||
column: x => x.CashierId,
|
||||
principalTable: "Cashiers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Creditings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CardId = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<int>(type: "int", nullable: false),
|
||||
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateClose = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Status = table.Column<int>(type: "int", 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<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CardId = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<int>(type: "int", nullable: false),
|
||||
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateClose = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
Status = table.Column<int>(type: "int", 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.CreateTable(
|
||||
name: "CashWithdrawals",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
DebitingId = table.Column<int>(type: "int", nullable: false),
|
||||
AccountId = table.Column<int>(type: "int", nullable: false),
|
||||
CashierId = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<int>(type: "int", nullable: false),
|
||||
DateOperation = table.Column<DateTime>(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);
|
||||
table.ForeignKey(
|
||||
name: "FK_CashWithdrawals_Cashiers_CashierId",
|
||||
column: x => x.CashierId,
|
||||
principalTable: "Cashiers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
table.ForeignKey(
|
||||
name: "FK_CashWithdrawals_Debitings_DebitingId",
|
||||
column: x => x.DebitingId,
|
||||
principalTable: "Debitings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
});
|
||||
|
||||
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_CashWithdrawals_CashierId",
|
||||
table: "CashWithdrawals",
|
||||
column: "CashierId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CashWithdrawals_DebitingId",
|
||||
table: "CashWithdrawals",
|
||||
column: "DebitingId");
|
||||
|
||||
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_AccountPayeerId",
|
||||
table: "MoneyTransfers",
|
||||
column: "AccountPayeerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MoneyTransfers_AccountSenderId",
|
||||
table: "MoneyTransfers",
|
||||
column: "AccountSenderId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MoneyTransfers_CashierId",
|
||||
table: "MoneyTransfers",
|
||||
column: "CashierId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CashWithdrawals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Creditings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MoneyTransfers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Debitings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cards");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Accounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cashiers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
}
|
||||
}
|
||||
}
|
462
BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230516172054_SmallFix.Designer.cs
generated
Normal file
462
BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230516172054_SmallFix.Designer.cs
generated
Normal file
@ -0,0 +1,462 @@
|
||||
// <auto-generated />
|
||||
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("20230516172054_SmallFix")]
|
||||
partial class SmallFix
|
||||
{
|
||||
/// <inheritdoc />
|
||||
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("BankYouBankruptDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Balance")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CVC")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClientID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("Period")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("ClientID");
|
||||
|
||||
b.ToTable("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOperation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DebitingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("DebitingId");
|
||||
|
||||
b.ToTable("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cashiers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateClose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Creditings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateClose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountPayeeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AccountPayeerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("AccountSenderId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("CreditingId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOperation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountPayeerId");
|
||||
|
||||
b.HasIndex("AccountSenderId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("CreditingId");
|
||||
|
||||
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.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||
.WithMany("CashWithdrawals")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Debiting", "Debiting")
|
||||
.WithMany()
|
||||
.HasForeignKey("DebitingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
|
||||
b.Navigation("Debiting");
|
||||
});
|
||||
|
||||
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", "AccountPayeer")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountPayeerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", "AccountSender")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountSenderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||
.WithMany("MoneyTransfers")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Crediting", null)
|
||||
.WithMany("MoneyTransfers")
|
||||
.HasForeignKey("CreditingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AccountPayeer");
|
||||
|
||||
b.Navigation("AccountSender");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Navigation("Creditings");
|
||||
|
||||
b.Navigation("Debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
|
||||
b.Navigation("MoneyTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
|
||||
{
|
||||
b.Navigation("MoneyTransfers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BankYouBankruptDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class SmallFix : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MoneyTransfers_CreditingId",
|
||||
table: "MoneyTransfers",
|
||||
column: "CreditingId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_MoneyTransfers_Creditings_CreditingId",
|
||||
table: "MoneyTransfers",
|
||||
column: "CreditingId",
|
||||
principalTable: "Creditings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_MoneyTransfers_Creditings_CreditingId",
|
||||
table: "MoneyTransfers");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_MoneyTransfers_CreditingId",
|
||||
table: "MoneyTransfers");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,459 @@
|
||||
// <auto-generated />
|
||||
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.5")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("AccountNumber")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Balance")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("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<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CVC")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClientID")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("Period")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("ClientID");
|
||||
|
||||
b.ToTable("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOperation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DebitingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("DebitingId");
|
||||
|
||||
b.ToTable("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Cashiers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Surname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Telephone")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateClose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Creditings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateClose")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateOpen")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountPayeeId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AccountPayeerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("AccountSenderId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CashierId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("CreditingId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateOperation")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountPayeerId");
|
||||
|
||||
b.HasIndex("AccountSenderId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("CreditingId");
|
||||
|
||||
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.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||
.WithMany("CashWithdrawals")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Debiting", "Debiting")
|
||||
.WithMany()
|
||||
.HasForeignKey("DebitingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
|
||||
b.Navigation("Debiting");
|
||||
});
|
||||
|
||||
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", "AccountPayeer")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountPayeerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", "AccountSender")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountSenderId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||
.WithMany("MoneyTransfers")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Crediting", null)
|
||||
.WithMany("MoneyTransfers")
|
||||
.HasForeignKey("CreditingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("AccountPayeer");
|
||||
|
||||
b.Navigation("AccountSender");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Navigation("Creditings");
|
||||
|
||||
b.Navigation("Debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
|
||||
b.Navigation("MoneyTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b =>
|
||||
{
|
||||
b.Navigation("MoneyTransfers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -42,9 +42,11 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
public virtual List<CashWithdrawal> CashWithdrawals { get; set; } = new();
|
||||
|
||||
//для реализации связи один ко многим с Переводом денег
|
||||
[NotMapped]
|
||||
[ForeignKey("AccountSenderId")]
|
||||
public virtual List<MoneyTransfer> MoneyTransferSenders { get; set; } = new();
|
||||
|
||||
[NotMapped]
|
||||
[ForeignKey("AccountPayeeId")]
|
||||
public virtual List<MoneyTransfer> MoneyTransferPayees { get; set; } = new();
|
||||
|
||||
|
@ -5,6 +5,7 @@ using BankYouBankruptDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@ -32,7 +33,11 @@ namespace BankYouBankruptDatabaseImplement.Models
|
||||
[Required]
|
||||
public StatusEnum Status { get; set; }
|
||||
|
||||
public CreditingViewModel GetViewModel => new()
|
||||
//для реализации связи один ко многим с переводом денег
|
||||
[ForeignKey("CreditingId")]
|
||||
public virtual List<MoneyTransfer> MoneyTransfers { get; set; } = new();
|
||||
|
||||
public CreditingViewModel GetViewModel => new()
|
||||
{
|
||||
Id = Id,
|
||||
CardId = CardId,
|
||||
|
Loading…
Reference in New Issue
Block a user