Миграция БД + небольшой фикс HomeController

This commit is contained in:
abazov73 2023-04-07 18:04:25 +04:00
parent 9d969f1c1e
commit 9201113e0d
6 changed files with 1350 additions and 1 deletions

View File

@ -0,0 +1,480 @@
// <auto-generated />
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
{
/// <inheritdoc />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("MiddleName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("BankOperators");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BankOperatorId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<float>("Percent")
.HasColumnType("real");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.ToTable("CreditPrograms");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CreditProgramId")
.HasColumnType("int");
b.Property<int>("CurrencyId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreditProgramId");
b.HasIndex("CurrencyId");
b.ToTable("CreditProgramCurrencies");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BankOperatorId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.ToTable("Currencies");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CurrencyId")
.HasColumnType("int");
b.Property<int>("PaymentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CurrencyId");
b.HasIndex("PaymentId");
b.ToTable("CurrencyPayments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<float>("Amount")
.HasColumnType("real");
b.Property<int>("BankOperatorId")
.HasColumnType("int");
b.Property<int>("CurrencyId")
.HasColumnType("int");
b.Property<DateTime>("PurchaseDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.HasIndex("CurrencyId");
b.ToTable("CurrencyPurchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int?>("CreditProgramId")
.HasColumnType("int");
b.Property<DateTime>("DealDate")
.HasColumnType("datetime2");
b.Property<int>("OperatorId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreditProgramId");
b.HasIndex("OperatorId");
b.ToTable("Deals");
});
modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DealId")
.HasColumnType("int");
b.Property<int>("PaymentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DealId");
b.HasIndex("PaymentId");
b.ToTable("DealPayments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Operator", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("MiddleName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Operators");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OperatorId")
.HasColumnType("int");
b.Property<DateTime>("PaymentDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("OperatorId");
b.ToTable("Payments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<float>("Amount")
.HasColumnType("real");
b.Property<int>("OperatorId")
.HasColumnType("int");
b.Property<int>("PaymentId")
.HasColumnType("int");
b.Property<DateTime>("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
}
}
}

View File

@ -0,0 +1,383 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BankDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BankOperators",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
MiddleName = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BankOperators", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Operators",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Login = table.Column<string>(type: "nvarchar(max)", nullable: false),
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
LastName = table.Column<string>(type: "nvarchar(max)", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(max)", nullable: false),
MiddleName = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Operators", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CreditPrograms",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Percent = table.Column<float>(type: "real", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
BankOperatorId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
BankOperatorId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
PaymentDate = table.Column<DateTime>(type: "datetime2", nullable: false),
OperatorId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
ClientId = table.Column<int>(type: "int", nullable: false),
DealDate = table.Column<DateTime>(type: "datetime2", nullable: false),
OperatorId = table.Column<int>(type: "int", nullable: false),
CreditProgramId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CurrencyId = table.Column<int>(type: "int", nullable: false),
CreditProgramId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Amount = table.Column<float>(type: "real", nullable: false),
PurchaseDate = table.Column<DateTime>(type: "datetime2", nullable: false),
BankOperatorId = table.Column<int>(type: "int", nullable: false),
CurrencyId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CurrencyId = table.Column<int>(type: "int", nullable: false),
PaymentId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Amount = table.Column<float>(type: "real", nullable: false),
TransferDateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
PaymentId = table.Column<int>(type: "int", nullable: false),
OperatorId = table.Column<int>(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<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DealId = table.Column<int>(type: "int", nullable: false),
PaymentId = table.Column<int>(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");
}
/// <inheritdoc />
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");
}
}
}

View File

@ -0,0 +1,477 @@
// <auto-generated />
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<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("MiddleName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("BankOperators");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgram", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BankOperatorId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<float>("Percent")
.HasColumnType("real");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.ToTable("CreditPrograms");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CreditProgramCurrency", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CreditProgramId")
.HasColumnType("int");
b.Property<int>("CurrencyId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreditProgramId");
b.HasIndex("CurrencyId");
b.ToTable("CreditProgramCurrencies");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Currency", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BankOperatorId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.ToTable("Currencies");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPayment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("CurrencyId")
.HasColumnType("int");
b.Property<int>("PaymentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CurrencyId");
b.HasIndex("PaymentId");
b.ToTable("CurrencyPayments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.CurrencyPurchase", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<float>("Amount")
.HasColumnType("real");
b.Property<int>("BankOperatorId")
.HasColumnType("int");
b.Property<int>("CurrencyId")
.HasColumnType("int");
b.Property<DateTime>("PurchaseDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("BankOperatorId");
b.HasIndex("CurrencyId");
b.ToTable("CurrencyPurchases");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Deal", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int?>("CreditProgramId")
.HasColumnType("int");
b.Property<DateTime>("DealDate")
.HasColumnType("datetime2");
b.Property<int>("OperatorId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreditProgramId");
b.HasIndex("OperatorId");
b.ToTable("Deals");
});
modelBuilder.Entity("BankDatabaseImplement.Models.DealPayment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("DealId")
.HasColumnType("int");
b.Property<int>("PaymentId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DealId");
b.HasIndex("PaymentId");
b.ToTable("DealPayments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Operator", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Login")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("MiddleName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Operators");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Payment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("OperatorId")
.HasColumnType("int");
b.Property<DateTime>("PaymentDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("OperatorId");
b.ToTable("Payments");
});
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<float>("Amount")
.HasColumnType("real");
b.Property<int>("OperatorId")
.HasColumnType("int");
b.Property<int>("PaymentId")
.HasColumnType("int");
b.Property<DateTime>("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
}
}
}

View File

@ -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,

View File

@ -7,11 +7,16 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BankContracts\BankContracts.csproj" />
<ProjectReference Include="..\BankDatabaseImplement\BankDatabaseImplement.csproj" />
</ItemGroup>
</Project>

View File

@ -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())
{