Фиксы создания счета
This commit is contained in:
parent
159c1286e5
commit
562f48bf35
@ -60,7 +60,14 @@ namespace BankBusinessLogic.BusinessLogic.Cashier
|
||||
// Вывод всего списка счетов
|
||||
public List<AccountViewModel>? ReadList(AccountSearchModel? model)
|
||||
{
|
||||
_logger.LogInformation("ReadList. AccountNumber:{AccountNumber}. Id:{Id}", model.AccountNumber, model?.Id);
|
||||
if (model != null)
|
||||
{
|
||||
_logger.LogInformation("ReadList. AccountNumber:{AccountNumber}. Id:{Id}", model.AccountNumber, model.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation("ReadList without filter model");
|
||||
}
|
||||
|
||||
// list хранит весь список в случае, если model пришло со значением null на вход метода
|
||||
var list = model == null ? _accountStorage.GetFullList() : _accountStorage.GetFilteredList(model);
|
||||
@ -76,6 +83,7 @@ namespace BankBusinessLogic.BusinessLogic.Cashier
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
// Метод, отвечающий за изменение баланса счёта
|
||||
public bool ChangeBalance(AccountSearchModel? model, int sum)
|
||||
{
|
||||
|
@ -54,21 +54,29 @@ namespace BankCashierApp
|
||||
}
|
||||
|
||||
//Post-запрос
|
||||
public static void PostRequest<T>(string requestUrl, T model)
|
||||
public static async Task PostRequest<T>(string requestUrl, T model)
|
||||
{
|
||||
var json = JsonConvert.SerializeObject(model);
|
||||
var data = new StringContent(json, Encoding.UTF8, "application/json");
|
||||
|
||||
var response = _client.PostAsync(requestUrl, data);
|
||||
|
||||
var result = response.Result.Content.ReadAsStringAsync().Result;
|
||||
|
||||
if (!response.Result.IsSuccessStatusCode)
|
||||
HttpResponseMessage response;
|
||||
try
|
||||
{
|
||||
throw new Exception(result);
|
||||
response = await _client.PostAsync(requestUrl, data).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("Failed to send POST request", ex);
|
||||
}
|
||||
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
|
||||
throw new Exception($"Failed to send POST request. Status code: {response.StatusCode}. Response content: {result}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Post-запрос для получения данных
|
||||
public static T? PostRequestReport<T, U>(string requestUrl, U model)
|
||||
{
|
||||
|
@ -7,8 +7,6 @@
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
<link rel="stylesheet" href="~/BankCashierApp.styles.css" asp-append-version="true" />
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<style>
|
||||
body.MyBody {
|
||||
background-color: #f8f9fa;
|
||||
|
@ -1,454 +0,0 @@
|
||||
// <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("20240528115207_init")]
|
||||
partial class init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.18")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.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<int>("StatusAccount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.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>("DateWithdrawal")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("DebitingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("DebitingId");
|
||||
|
||||
b.ToTable("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.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>("MobilePhone")
|
||||
.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.HasKey("Id");
|
||||
|
||||
b.ToTable("Cashiers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.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>("DateTransfer")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountPayeerId");
|
||||
|
||||
b.HasIndex("AccountSenderId");
|
||||
|
||||
b.HasIndex("CashierId");
|
||||
|
||||
b.HasIndex("CreditingId");
|
||||
|
||||
b.ToTable("MoneyTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Card", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Balance")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ClientSurname")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("Period")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("StatusCard")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.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>("MobilePhone")
|
||||
.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.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Crediting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCredit")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Creditings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Debiting", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateDebit")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.ToTable("Debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.Account", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.CashierModels.Cashier", null)
|
||||
.WithMany("Accounts")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.ClientModels.Client", "Client")
|
||||
.WithMany()
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.CashWithdrawal", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.CashierModels.Account", "Account")
|
||||
.WithMany("CashWithdrawals")
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.CashierModels.Cashier", "Cashier")
|
||||
.WithMany("CashWithdrawals")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.ClientModels.Debiting", "Debiting")
|
||||
.WithMany()
|
||||
.HasForeignKey("DebitingId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
|
||||
b.Navigation("Debiting");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.MoneyTransfer", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.CashierModels.Account", "AccountPayeer")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountPayeerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.CashierModels.Account", "AccountSender")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountSenderId");
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.CashierModels.Cashier", "Cashier")
|
||||
.WithMany("MoneyTransfers")
|
||||
.HasForeignKey("CashierId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.ClientModels.Crediting", null)
|
||||
.WithMany("MoneyTransfers")
|
||||
.HasForeignKey("CreditingId");
|
||||
|
||||
b.Navigation("AccountPayeer");
|
||||
|
||||
b.Navigation("AccountSender");
|
||||
|
||||
b.Navigation("Cashier");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Card", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.CashierModels.Account", "Account")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.ClientModels.Client", "Client")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Crediting", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.ClientModels.Card", "Card")
|
||||
.WithMany("creditings")
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Card");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Debiting", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.ClientModels.Card", "Card")
|
||||
.WithMany("debitings")
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Card");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.Account", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CashierModels.Cashier", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
|
||||
b.Navigation("CashWithdrawals");
|
||||
|
||||
b.Navigation("MoneyTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Card", b =>
|
||||
{
|
||||
b.Navigation("creditings");
|
||||
|
||||
b.Navigation("debitings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Client", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.ClientModels.Crediting", b =>
|
||||
{
|
||||
b.Navigation("MoneyTransfers");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -1,324 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BankDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class init : 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),
|
||||
MobilePhone = 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),
|
||||
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
MobilePhone = 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),
|
||||
Balance = table.Column<double>(type: "float", nullable: false),
|
||||
DateOpen = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
StatusAccount = table.Column<int>(type: "int", 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),
|
||||
Balance = table.Column<double>(type: "float", nullable: false),
|
||||
Period = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
StatusCard = table.Column<int>(type: "int", nullable: false),
|
||||
ClientSurname = table.Column<string>(type: "nvarchar(max)", 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.Cascade);
|
||||
});
|
||||
|
||||
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),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
DateCredit = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Creditings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Creditings_Cards_CardId",
|
||||
column: x => x.CardId,
|
||||
principalTable: "Cards",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Debitings",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CardId = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
DateDebit = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Debitings", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Debitings_Cards_CardId",
|
||||
column: x => x.CardId,
|
||||
principalTable: "Cards",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MoneyTransfers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Sum = table.Column<double>(type: "float", nullable: false),
|
||||
AccountSenderId = table.Column<int>(type: "int", nullable: true),
|
||||
AccountPayeeId = table.Column<int>(type: "int", nullable: false),
|
||||
DateTransfer = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
CreditingId = table.Column<int>(type: "int", nullable: true),
|
||||
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");
|
||||
table.ForeignKey(
|
||||
name: "FK_MoneyTransfers_Cashiers_CashierId",
|
||||
column: x => x.CashierId,
|
||||
principalTable: "Cashiers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_MoneyTransfers_Creditings_CreditingId",
|
||||
column: x => x.CreditingId,
|
||||
principalTable: "Creditings",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
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<double>(type: "float", nullable: false),
|
||||
DateWithdrawal = 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.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CashWithdrawals_Debitings_DebitingId",
|
||||
column: x => x.DebitingId,
|
||||
principalTable: "Debitings",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_CashierId",
|
||||
table: "Accounts",
|
||||
column: "CashierId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_ClientId",
|
||||
table: "Accounts",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cards_AccountId",
|
||||
table: "Cards",
|
||||
column: "AccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cards_ClientId",
|
||||
table: "Cards",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CashWithdrawals_AccountId",
|
||||
table: "CashWithdrawals",
|
||||
column: "AccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_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");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MoneyTransfers_CreditingId",
|
||||
table: "MoneyTransfers",
|
||||
column: "CreditingId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CashWithdrawals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MoneyTransfers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Debitings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Creditings");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cards");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Accounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cashiers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user