Another small fix.
This commit is contained in:
parent
d595f076ed
commit
2b6f447621
456
BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230516175437_NewSmallFix.Designer.cs
generated
Normal file
456
BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230516175437_NewSmallFix.Designer.cs
generated
Normal file
@ -0,0 +1,456 @@
|
|||||||
|
// <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("20230516175437_NewSmallFix")]
|
||||||
|
partial class NewSmallFix
|
||||||
|
{
|
||||||
|
/// <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")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("CashierId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("CreditingId")
|
||||||
|
.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");
|
||||||
|
|
||||||
|
b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||||
|
.WithMany("MoneyTransfers")
|
||||||
|
.HasForeignKey("CashierId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("BankYouBankruptDatabaseImplement.Models.Crediting", null)
|
||||||
|
.WithMany("MoneyTransfers")
|
||||||
|
.HasForeignKey("CreditingId");
|
||||||
|
|
||||||
|
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,100 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace BankYouBankruptDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class NewSmallFix : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Accounts_AccountSenderId",
|
||||||
|
table: "MoneyTransfers");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Creditings_CreditingId",
|
||||||
|
table: "MoneyTransfers");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "CreditingId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "AccountSenderId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Accounts_AccountSenderId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
column: "AccountSenderId",
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Creditings_CreditingId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
column: "CreditingId",
|
||||||
|
principalTable: "Creditings",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Accounts_AccountSenderId",
|
||||||
|
table: "MoneyTransfers");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Creditings_CreditingId",
|
||||||
|
table: "MoneyTransfers");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "CreditingId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "AccountSenderId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Accounts_AccountSenderId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
column: "AccountSenderId",
|
||||||
|
principalTable: "Accounts",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_MoneyTransfers_Creditings_CreditingId",
|
||||||
|
table: "MoneyTransfers",
|
||||||
|
column: "CreditingId",
|
||||||
|
principalTable: "Creditings",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -276,14 +276,12 @@ namespace BankYouBankruptDatabaseImplement.Migrations
|
|||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int?>("AccountSenderId")
|
b.Property<int?>("AccountSenderId")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("CashierId")
|
b.Property<int>("CashierId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int?>("CreditingId")
|
b.Property<int?>("CreditingId")
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<DateTime>("DateOperation")
|
b.Property<DateTime>("DateOperation")
|
||||||
@ -398,9 +396,7 @@ namespace BankYouBankruptDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", "AccountSender")
|
b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", "AccountSender")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("AccountSenderId")
|
.HasForeignKey("AccountSenderId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
b.HasOne("BankYouBankruptDatabaseImplement.Models.Cashier", "Cashier")
|
||||||
.WithMany("MoneyTransfers")
|
.WithMany("MoneyTransfers")
|
||||||
@ -410,9 +406,7 @@ namespace BankYouBankruptDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasOne("BankYouBankruptDatabaseImplement.Models.Crediting", null)
|
b.HasOne("BankYouBankruptDatabaseImplement.Models.Crediting", null)
|
||||||
.WithMany("MoneyTransfers")
|
.WithMany("MoneyTransfers")
|
||||||
.HasForeignKey("CreditingId")
|
.HasForeignKey("CreditingId");
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("AccountPayeer");
|
b.Navigation("AccountPayeer");
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int Sum { get; set; }
|
public int Sum { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
public int? AccountSenderId { get; set; }
|
public int? AccountSenderId { get; set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
@ -27,7 +26,6 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public DateTime DateOperation { get; set; }
|
public DateTime DateOperation { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
public int? CreditingId { get; set; }
|
public int? CreditingId { get; set; }
|
||||||
|
|
||||||
public int CashierId { get; set; }
|
public int CashierId { get; set; }
|
||||||
@ -45,11 +43,13 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
Sum = model.Sum,
|
Sum = model.Sum,
|
||||||
Cashier = context.Cashiers.First(x => x.Id == model.CashierId),
|
Cashier = context.Cashiers.First(x => x.Id == model.CashierId),
|
||||||
AccountSender = context.Accounts.First(x => x.Id == model.AccountSenderId),
|
AccountSender = model.AccountSenderId == null ? null : context.Accounts.First(x => x.Id == model.AccountSenderId),
|
||||||
AccountPayeer = context.Accounts.First(x => x.Id == model.AccountPayeeId),
|
AccountPayeer = context.Accounts.First(x => x.Id == model.AccountPayeeId),
|
||||||
AccountSenderId = model.AccountSenderId,
|
AccountSenderId = model.AccountSenderId,
|
||||||
AccountPayeeId = model.AccountPayeeId,
|
AccountPayeeId = model.AccountPayeeId,
|
||||||
DateOperation = model.DateOperation
|
DateOperation = model.DateOperation,
|
||||||
|
CreditingId = model.CreditingId,
|
||||||
|
CashierId = model.CashierId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace BankYouBankruptDatabaseImplement.Models
|
|||||||
AccountPayeeId = AccountPayeeId,
|
AccountPayeeId = AccountPayeeId,
|
||||||
AccountSenderId = AccountSenderId,
|
AccountSenderId = AccountSenderId,
|
||||||
AccountPayeeNumber = AccountPayeer.AccountNumber,
|
AccountPayeeNumber = AccountPayeer.AccountNumber,
|
||||||
AccountSenderNumber = AccountSender.AccountNumber,
|
AccountSenderNumber = AccountSenderId == null ? null : AccountSender.AccountNumber,
|
||||||
DateOperation = DateOperation,
|
DateOperation = DateOperation,
|
||||||
Sum = Sum,
|
Sum = Sum,
|
||||||
CreditingId = CreditingId,
|
CreditingId = CreditingId,
|
||||||
|
@ -20,14 +20,21 @@ namespace BankYouBankruptRestApi.Controllers
|
|||||||
|
|
||||||
private readonly IDebitingLogic _debitingLogic;
|
private readonly IDebitingLogic _debitingLogic;
|
||||||
|
|
||||||
|
private readonly ICreditingLogic _creditingLogic;
|
||||||
|
|
||||||
private readonly ICashWithdrawalLogic _cashLogic;
|
private readonly ICashWithdrawalLogic _cashLogic;
|
||||||
|
|
||||||
public AccountController(IAccountLogic accountLogic, IDebitingLogic debitingLogic, ICashWithdrawalLogic cashLogic, ILogger<AccountController> logger)
|
private readonly IMoneyTransferLogic _moneyTransferLogic;
|
||||||
|
|
||||||
|
public AccountController(IAccountLogic accountLogic, IDebitingLogic debitingLogic, ICashWithdrawalLogic cashLogic,
|
||||||
|
ICreditingLogic creditingLogic, IMoneyTransferLogic moneyTransferLogic, ILogger<AccountController> logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_accountLogic = accountLogic;
|
_accountLogic = accountLogic;
|
||||||
_debitingLogic = debitingLogic;
|
_debitingLogic = debitingLogic;
|
||||||
_cashLogic = cashLogic;
|
_cashLogic = cashLogic;
|
||||||
|
_creditingLogic = creditingLogic;
|
||||||
|
_moneyTransferLogic = moneyTransferLogic;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -134,9 +141,27 @@ namespace BankYouBankruptRestApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//найти все открытые заявки на снятие средств
|
||||||
|
[HttpGet]
|
||||||
|
public List<CreditingViewModel>? FindOpenCrediting()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _creditingLogic.ReadList(new CreditingSearchModel
|
||||||
|
{
|
||||||
|
Status = StatusEnum.Открыта
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка входа в систему");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//подтверждение заявки на снятие средств со счёта
|
//подтверждение заявки на снятие средств со счёта
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CloseApplication(CashWithdrawalBindingModel CashWithdrawal)
|
public void CloseDebiting(CashWithdrawalBindingModel CashWithdrawal)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -153,5 +178,34 @@ namespace BankYouBankruptRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//подтверждение заявки на снятие средств со счёта
|
||||||
|
[HttpPost]
|
||||||
|
public void CloseCrediting(MoneyTransferBindingModel moneyTransfer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_moneyTransferLogic.Create(moneyTransfer);
|
||||||
|
|
||||||
|
_accountLogic.ChangeBalance(new AccountSearchModel
|
||||||
|
{
|
||||||
|
Id = moneyTransfer.AccountPayeeId
|
||||||
|
}, moneyTransfer.Sum);
|
||||||
|
|
||||||
|
//если нет отправителя, т. е. операция на перевод денег из нала в виртуал на карту
|
||||||
|
if (moneyTransfer.AccountSenderId.HasValue)
|
||||||
|
{
|
||||||
|
_accountLogic.ChangeBalance(new AccountSearchModel
|
||||||
|
{
|
||||||
|
Id = moneyTransfer.AccountSenderId
|
||||||
|
}, moneyTransfer.Sum * -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка входа в систему");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,12 +76,6 @@ namespace BankYouBankruptRestApi.Controllers
|
|||||||
public void CreateCreditingOperation(CreditingBindingModel model) {
|
public void CreateCreditingOperation(CreditingBindingModel model) {
|
||||||
try {
|
try {
|
||||||
_creditingLogic.Create(model);
|
_creditingLogic.Create(model);
|
||||||
|
|
||||||
|
|
||||||
//_accountLogic.ChangeBalance(new AccountSearchModel
|
|
||||||
//{
|
|
||||||
// Id = _cardLogic.ReadElement(new CardSearchModel { Id = model.CardId }).AccountId
|
|
||||||
//}, model.Sum);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
_logger.LogError(ex, "Ошибка создания операции на пополнение");
|
_logger.LogError(ex, "Ошибка создания операции на пополнение");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user