Миграция прошла
This commit is contained in:
parent
ef9678b4be
commit
3eebc8e4f8
@ -12,7 +12,7 @@ namespace BankContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public string Number { get; set; } = string.Empty;
|
||||
public int Money { get; set; }
|
||||
public DateOnly ReleaseDate { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
public DateTime ReleaseDate { get; set; } = DateTime.Now;
|
||||
public int ManagerId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ namespace BankContracts.BindingModels
|
||||
public string Number { get; set; } = string.Empty;
|
||||
public string Cvv { get; set; } = string.Empty;
|
||||
public string Pin { get; set; } = string.Empty;
|
||||
public DateOnly ReleaseDate { get; set; }
|
||||
public DateOnly ExpirationDate { get; set; }
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
public DateTime ExpirationDate { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int? AccountId { get; set; }
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ namespace BankContracts.SearchModels
|
||||
{
|
||||
public int? Id { get; set; }
|
||||
public string? Number { get; set; }
|
||||
public DateOnly? ReleaseDate { get; set; }
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
public int? ManagerId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ namespace BankContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? Number { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public DateOnly? ReleaseDate { get; set; }
|
||||
public DateOnly? ExpirationDate { get; set; }
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
public DateTime? ExpirationDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace BankContracts.ViewModels
|
||||
[DisplayName("Деньги на счёте")]
|
||||
public int Money { get; set; }
|
||||
[DisplayName("Дата открытия")]
|
||||
public DateOnly ReleaseDate { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
||||
public DateTime ReleaseDate { get; set; } = DateTime.Now;
|
||||
[DisplayName("Менеджер")]
|
||||
public string ManagerName { get; set; } = string.Empty;
|
||||
public int ManagerId { get; set; }
|
||||
|
@ -18,9 +18,9 @@ namespace BankContracts.ViewModels
|
||||
[DisplayName("PIN-код")]
|
||||
public string Pin { get; set; } = string.Empty;
|
||||
[DisplayName("Дата выпуска")]
|
||||
public DateOnly ReleaseDate { get; set; }
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
[DisplayName("Дата окончания действия")]
|
||||
public DateOnly ExpirationDate { get; set; }
|
||||
public DateTime ExpirationDate { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
[DisplayName("Держатель карты")]
|
||||
public string ClientName { get; set; } = string.Empty;
|
||||
|
@ -10,7 +10,7 @@ namespace BankDataModels.Models
|
||||
{
|
||||
string Number { get; set; }
|
||||
int Money { get; set; }
|
||||
DateOnly ReleaseDate { get; set; }
|
||||
DateTime ReleaseDate { get; set; }
|
||||
int ManagerId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ namespace BankDataModels.Models
|
||||
string Number { get; set; }
|
||||
string Cvv { get; set; }
|
||||
string Pin { get; set; }
|
||||
DateOnly ReleaseDate { get; set; }
|
||||
DateOnly ExpirationDate { get; set; }
|
||||
DateTime ReleaseDate { get; set; }
|
||||
DateTime ExpirationDate { get; set; }
|
||||
int ClientId { get; set; }
|
||||
int? AccountId { get; set; }
|
||||
}
|
||||
|
@ -15,6 +15,27 @@ namespace BankDatabaseImplement
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Transfer>()
|
||||
.HasOne(t => t.SenderAccount)
|
||||
.WithMany(a => a.SenderTransfers)
|
||||
.HasForeignKey(t => t.SenderAccountId);
|
||||
modelBuilder.Entity<Transfer>()
|
||||
.HasOne(t => t.RecipientAccount)
|
||||
.WithMany(a => a.RecipientTransfers)
|
||||
.HasForeignKey(t => t.RecipientAccountId);
|
||||
modelBuilder.Entity<Operation>()
|
||||
.HasOne(t => t.SenderCard)
|
||||
.WithMany(a => a.SenderOperations)
|
||||
.HasForeignKey(t => t.SenderCardId);
|
||||
modelBuilder.Entity<Operation>()
|
||||
.HasOne(t => t.RecipientCard)
|
||||
.WithMany(a => a.RecipientOperations)
|
||||
.HasForeignKey(t => t.RecipientCardId);
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
|
||||
public virtual DbSet<Client> Clients { get; set; }
|
||||
public virtual DbSet<Card> Cards { get; set; }
|
||||
public virtual DbSet<Operation> Operations { get; set; }
|
||||
|
474
Bank/BankDatabaseImplement/Migrations/20240429090634_InitialCreate.Designer.cs
generated
Normal file
474
Bank/BankDatabaseImplement/Migrations/20240429090634_InitialCreate.Designer.cs
generated
Normal file
@ -0,0 +1,474 @@
|
||||
// <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("20240429090634_InitialCreate")]
|
||||
partial class InitialCreate
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ManagerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Money")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ManagerId");
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.AccountWithdrawal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WithdrawalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("WithdrawalId");
|
||||
|
||||
b.ToTable("AccountWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("AccountId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Cvv")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("ExpirationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Pin")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CardRequest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("CardRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.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>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Manager", 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>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Managers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("OperationTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RecipientCardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("SenderCardId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipientCardId");
|
||||
|
||||
b.HasIndex("SenderCardId");
|
||||
|
||||
b.ToTable("Operations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("RequestTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Requests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("OperationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RecipientAccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SenderAccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("TransferTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OperationId");
|
||||
|
||||
b.HasIndex("RecipientAccountId");
|
||||
|
||||
b.HasIndex("SenderAccountId");
|
||||
|
||||
b.ToTable("Transfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Withdrawal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RequestId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("WithdrawalTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("Withdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Manager", "Manager")
|
||||
.WithMany("Accounts")
|
||||
.HasForeignKey("ManagerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manager");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.AccountWithdrawal", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "Account")
|
||||
.WithMany("AccountWithdrawals")
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Withdrawal", "Withdrawal")
|
||||
.WithMany("Accounts")
|
||||
.HasForeignKey("WithdrawalId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Withdrawal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "Account")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CardRequest", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Card", "Card")
|
||||
.WithMany("CardRequests")
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Card");
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Card", "RecipientCard")
|
||||
.WithMany("RecipientOperations")
|
||||
.HasForeignKey("RecipientCardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Card", "SenderCard")
|
||||
.WithMany("SenderOperations")
|
||||
.HasForeignKey("SenderCardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("RecipientCard");
|
||||
|
||||
b.Navigation("SenderCard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Operation", "Operation")
|
||||
.WithMany()
|
||||
.HasForeignKey("OperationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "RecipientAccount")
|
||||
.WithMany("RecipientTransfers")
|
||||
.HasForeignKey("RecipientAccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "SenderAccount")
|
||||
.WithMany("SenderTransfers")
|
||||
.HasForeignKey("SenderAccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Operation");
|
||||
|
||||
b.Navigation("RecipientAccount");
|
||||
|
||||
b.Navigation("SenderAccount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Withdrawal", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany()
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Navigation("AccountWithdrawals");
|
||||
|
||||
b.Navigation("RecipientTransfers");
|
||||
|
||||
b.Navigation("SenderTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Navigation("CardRequests");
|
||||
|
||||
b.Navigation("RecipientOperations");
|
||||
|
||||
b.Navigation("SenderOperations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Manager", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Withdrawal", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,349 @@
|
||||
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: "Clients",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Fio = 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: "Managers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Fio = 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_Managers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Requests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Sum = table.Column<int>(type: "int", nullable: false),
|
||||
RequestTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Status = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Requests", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Accounts",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Money = table.Column<int>(type: "int", nullable: false),
|
||||
ReleaseDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ManagerId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Accounts", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Accounts_Managers_ManagerId",
|
||||
column: x => x.ManagerId,
|
||||
principalTable: "Managers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Withdrawals",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
WithdrawalTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
RequestId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Withdrawals", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Withdrawals_Requests_RequestId",
|
||||
column: x => x.RequestId,
|
||||
principalTable: "Requests",
|
||||
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"),
|
||||
Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Cvv = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Pin = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
ReleaseDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ExpirationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
ClientId = table.Column<int>(type: "int", nullable: false),
|
||||
AccountId = table.Column<int>(type: "int", 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: "AccountWithdrawals",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
AccountId = table.Column<int>(type: "int", nullable: false),
|
||||
WithdrawalId = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_AccountWithdrawals", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_AccountWithdrawals_Accounts_AccountId",
|
||||
column: x => x.AccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_AccountWithdrawals_Withdrawals_WithdrawalId",
|
||||
column: x => x.WithdrawalId,
|
||||
principalTable: "Withdrawals",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CardRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
CardId = table.Column<int>(type: "int", nullable: false),
|
||||
RequestId = table.Column<int>(type: "int", nullable: false),
|
||||
Sum = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CardRequests", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CardRequests_Cards_CardId",
|
||||
column: x => x.CardId,
|
||||
principalTable: "Cards",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CardRequests_Requests_RequestId",
|
||||
column: x => x.RequestId,
|
||||
principalTable: "Requests",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Operations",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Sum = table.Column<int>(type: "int", nullable: false),
|
||||
OperationTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
SenderCardId = table.Column<int>(type: "int", nullable: false),
|
||||
RecipientCardId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Operations", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Operations_Cards_RecipientCardId",
|
||||
column: x => x.RecipientCardId,
|
||||
principalTable: "Cards",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Operations_Cards_SenderCardId",
|
||||
column: x => x.SenderCardId,
|
||||
principalTable: "Cards",
|
||||
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"),
|
||||
Sum = table.Column<int>(type: "int", nullable: false),
|
||||
TransferTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
OperationId = table.Column<int>(type: "int", nullable: false),
|
||||
SenderAccountId = table.Column<int>(type: "int", nullable: false),
|
||||
RecipientAccountId = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Transfers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Transfers_Accounts_RecipientAccountId",
|
||||
column: x => x.RecipientAccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Transfers_Accounts_SenderAccountId",
|
||||
column: x => x.SenderAccountId,
|
||||
principalTable: "Accounts",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Transfers_Operations_OperationId",
|
||||
column: x => x.OperationId,
|
||||
principalTable: "Operations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Accounts_ManagerId",
|
||||
table: "Accounts",
|
||||
column: "ManagerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountWithdrawals_AccountId",
|
||||
table: "AccountWithdrawals",
|
||||
column: "AccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccountWithdrawals_WithdrawalId",
|
||||
table: "AccountWithdrawals",
|
||||
column: "WithdrawalId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CardRequests_CardId",
|
||||
table: "CardRequests",
|
||||
column: "CardId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CardRequests_RequestId",
|
||||
table: "CardRequests",
|
||||
column: "RequestId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cards_AccountId",
|
||||
table: "Cards",
|
||||
column: "AccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Cards_ClientId",
|
||||
table: "Cards",
|
||||
column: "ClientId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Operations_RecipientCardId",
|
||||
table: "Operations",
|
||||
column: "RecipientCardId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Operations_SenderCardId",
|
||||
table: "Operations",
|
||||
column: "SenderCardId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Transfers_OperationId",
|
||||
table: "Transfers",
|
||||
column: "OperationId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Transfers_RecipientAccountId",
|
||||
table: "Transfers",
|
||||
column: "RecipientAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Transfers_SenderAccountId",
|
||||
table: "Transfers",
|
||||
column: "SenderAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Withdrawals_RequestId",
|
||||
table: "Withdrawals",
|
||||
column: "RequestId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "AccountWithdrawals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CardRequests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Transfers");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Withdrawals");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Operations");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Requests");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Cards");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Accounts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Clients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Managers");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,471 @@
|
||||
// <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.17")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ManagerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Money")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ManagerId");
|
||||
|
||||
b.ToTable("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.AccountWithdrawal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("AccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WithdrawalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("WithdrawalId");
|
||||
|
||||
b.ToTable("AccountWithdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("AccountId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Cvv")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("ExpirationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Pin")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("ReleaseDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.ToTable("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CardRequest", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("CardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RequestId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardId");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("CardRequests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.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>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Manager", 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>("Fio")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Managers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("OperationTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RecipientCardId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("SenderCardId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipientCardId");
|
||||
|
||||
b.HasIndex("SenderCardId");
|
||||
|
||||
b.ToTable("Operations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("RequestTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Requests");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("OperationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RecipientAccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SenderAccountId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Sum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("TransferTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OperationId");
|
||||
|
||||
b.HasIndex("RecipientAccountId");
|
||||
|
||||
b.HasIndex("SenderAccountId");
|
||||
|
||||
b.ToTable("Transfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Withdrawal", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int?>("RequestId")
|
||||
.IsRequired()
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("WithdrawalTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RequestId");
|
||||
|
||||
b.ToTable("Withdrawals");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Manager", "Manager")
|
||||
.WithMany("Accounts")
|
||||
.HasForeignKey("ManagerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Manager");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.AccountWithdrawal", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "Account")
|
||||
.WithMany("AccountWithdrawals")
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Withdrawal", "Withdrawal")
|
||||
.WithMany("Accounts")
|
||||
.HasForeignKey("WithdrawalId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Withdrawal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "Account")
|
||||
.WithMany()
|
||||
.HasForeignKey("AccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Client");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.CardRequest", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Card", "Card")
|
||||
.WithMany("CardRequests")
|
||||
.HasForeignKey("CardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Card");
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Operation", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Card", "RecipientCard")
|
||||
.WithMany("RecipientOperations")
|
||||
.HasForeignKey("RecipientCardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Card", "SenderCard")
|
||||
.WithMany("SenderOperations")
|
||||
.HasForeignKey("SenderCardId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("RecipientCard");
|
||||
|
||||
b.Navigation("SenderCard");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Transfer", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Operation", "Operation")
|
||||
.WithMany()
|
||||
.HasForeignKey("OperationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "RecipientAccount")
|
||||
.WithMany("RecipientTransfers")
|
||||
.HasForeignKey("RecipientAccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("BankDatabaseImplement.Models.Account", "SenderAccount")
|
||||
.WithMany("SenderTransfers")
|
||||
.HasForeignKey("SenderAccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Operation");
|
||||
|
||||
b.Navigation("RecipientAccount");
|
||||
|
||||
b.Navigation("SenderAccount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Withdrawal", b =>
|
||||
{
|
||||
b.HasOne("BankDatabaseImplement.Models.Request", "Request")
|
||||
.WithMany()
|
||||
.HasForeignKey("RequestId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Request");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Account", b =>
|
||||
{
|
||||
b.Navigation("AccountWithdrawals");
|
||||
|
||||
b.Navigation("RecipientTransfers");
|
||||
|
||||
b.Navigation("SenderTransfers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Card", b =>
|
||||
{
|
||||
b.Navigation("CardRequests");
|
||||
|
||||
b.Navigation("RecipientOperations");
|
||||
|
||||
b.Navigation("SenderOperations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Manager", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Request", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BankDatabaseImplement.Models.Withdrawal", b =>
|
||||
{
|
||||
b.Navigation("Accounts");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ namespace BankDatabaseImplement.Models
|
||||
[Required]
|
||||
public int Money { get; set; }
|
||||
[Required]
|
||||
public DateOnly ReleaseDate { get; set; }
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
[Required]
|
||||
public int ManagerId { get; set; }
|
||||
public virtual Manager? Manager { get; private set; }
|
||||
@ -39,7 +39,7 @@ namespace BankDatabaseImplement.Models
|
||||
{
|
||||
Id = model.Id,
|
||||
Number = model.Number,
|
||||
ReleaseDate = DateOnly.FromDateTime(DateTime.Now),
|
||||
ReleaseDate = DateTime.Now,
|
||||
ManagerId = model.ManagerId,
|
||||
Money = 0,
|
||||
};
|
||||
|
@ -22,9 +22,9 @@ namespace BankDatabaseImplement.Models
|
||||
[Required]
|
||||
public string Pin { get; set; } = string.Empty;
|
||||
[Required]
|
||||
public DateOnly ReleaseDate { get; set; }
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
[Required]
|
||||
public DateOnly ExpirationDate { get; set; }
|
||||
public DateTime ExpirationDate { get; set; }
|
||||
[Required]
|
||||
public int ClientId { get; set; }
|
||||
public virtual Client? Client { get; private set; }
|
||||
@ -47,8 +47,8 @@ namespace BankDatabaseImplement.Models
|
||||
Number = model.Number,
|
||||
Cvv = model.Cvv,
|
||||
Pin = model.Pin,
|
||||
ReleaseDate = DateOnly.FromDateTime(DateTime.Now),
|
||||
ExpirationDate = DateOnly.FromDateTime(DateTime.Now).AddYears(3),
|
||||
ReleaseDate = DateTime.Now,
|
||||
ExpirationDate = DateTime.Now.AddYears(3),
|
||||
ClientId = model.ClientId,
|
||||
AccountId = model.AccountId,
|
||||
};
|
||||
|
@ -4,6 +4,7 @@ using BankDataModels.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;
|
||||
@ -22,10 +23,10 @@ namespace BankDatabaseImplement.Models
|
||||
public virtual Operation? Operation { get; set; } = null;
|
||||
[Required]
|
||||
public int SenderAccountId { get; set; }
|
||||
public virtual Account? SenderAccount { get; set; }
|
||||
public virtual Account? SenderAccount { get; private set; }
|
||||
[Required]
|
||||
public int RecipientAccountId { get; set; }
|
||||
public virtual Account? RecipientAccount { get; set; }
|
||||
public virtual Account? RecipientAccount { get; private set; }
|
||||
|
||||
public static Transfer? Create(TransferBindingModel model)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user