diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514144846_Support.Designer.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514144846_Support.Designer.cs deleted file mode 100644 index 9fec44f..0000000 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514144846_Support.Designer.cs +++ /dev/null @@ -1,421 +0,0 @@ -// -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("20230514144846_Support")] - partial class Support - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AccountNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Balance") - .HasColumnType("float"); - - b.Property("CashierId") - .HasColumnType("int"); - - b.Property("ClientId") - .HasColumnType("int"); - - b.Property("DateOpen") - .HasColumnType("datetime2"); - - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("int"); - - b.Property("CVC") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ClientID") - .HasColumnType("int"); - - b.Property("Number") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Period") - .HasColumnType("datetime2"); - - b.HasKey("Id"); - - b.HasIndex("AccountId"); - - b.HasIndex("ClientID"); - - b.ToTable("Cards"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.CashWithdrawal", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AccountId") - .HasColumnType("int"); - - b.Property("CashierId") - .HasColumnType("int"); - - b.Property("DateOperation") - .HasColumnType("datetime2"); - - b.Property("DebitingId") - .HasColumnType("int"); - - b.Property("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("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Password") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Patronymic") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Surname") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telephone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Cashiers"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Email") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Password") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Patronymic") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Surname") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Telephone") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("Clients"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Crediting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CardId") - .HasColumnType("int"); - - b.Property("Date") - .HasColumnType("datetime2"); - - b.Property("Sum") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CardId"); - - b.ToTable("Creditings"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Debiting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CardId") - .HasColumnType("int"); - - b.Property("DateClose") - .IsRequired() - .HasColumnType("datetime2"); - - b.Property("DateOpen") - .HasColumnType("datetime2"); - - b.Property("Status") - .HasColumnType("int"); - - b.Property("Sum") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("CardId"); - - b.ToTable("Debitings"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.MoneyTransfer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AccountPayeeId") - .HasColumnType("int"); - - b.Property("AccountSenderId") - .HasColumnType("int"); - - b.Property("DateOperation") - .HasColumnType("datetime2"); - - b.Property("Sum") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("AccountPayeeId"); - - b.HasIndex("AccountSenderId"); - - 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", null) - .WithMany("MoneyTransferPayees") - .HasForeignKey("AccountPayeeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("BankYouBankruptDatabaseImplement.Models.Account", null) - .WithMany("MoneyTransferSenders") - .HasForeignKey("AccountSenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Account", b => - { - b.Navigation("Cards"); - - b.Navigation("CashWithdrawals"); - - b.Navigation("MoneyTransferPayees"); - - b.Navigation("MoneyTransferSenders"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Card", b => - { - b.Navigation("Creditings"); - - b.Navigation("Debitings"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Cashier", b => - { - b.Navigation("Accounts"); - - b.Navigation("CashWithdrawals"); - }); - - modelBuilder.Entity("BankYouBankruptDatabaseImplement.Models.Client", b => - { - b.Navigation("Cards"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514144846_Support.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514144846_Support.cs deleted file mode 100644 index 2a0d511..0000000 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514144846_Support.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace BankYouBankruptDatabaseImplement.Migrations -{ - /// - public partial class Support : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "DateClose", - table: "Debitings"); - - migrationBuilder.AddColumn( - name: "DateClose", - table: "Debitings", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514143703_InitMigration.Designer.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514152409_InitMigration.Designer.cs similarity index 99% rename from BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514143703_InitMigration.Designer.cs rename to BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514152409_InitMigration.Designer.cs index f8ce0b6..16dce07 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514143703_InitMigration.Designer.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514152409_InitMigration.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace BankYouBankruptDatabaseImplement.Migrations { [DbContext(typeof(BankYouBancruptDatabase))] - [Migration("20230514143703_InitMigration")] + [Migration("20230514152409_InitMigration")] partial class InitMigration { /// @@ -240,7 +240,6 @@ namespace BankYouBankruptDatabaseImplement.Migrations .HasColumnType("int"); b.Property("DateClose") - .IsRequired() .HasColumnType("datetime2"); b.Property("DateOpen") diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514143703_InitMigration.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514152409_InitMigration.cs similarity index 99% rename from BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514143703_InitMigration.cs rename to BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514152409_InitMigration.cs index 91b9cfe..c65010f 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514143703_InitMigration.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/20230514152409_InitMigration.cs @@ -164,7 +164,7 @@ namespace BankYouBankruptDatabaseImplement.Migrations CardId = table.Column(type: "int", nullable: false), Sum = table.Column(type: "int", nullable: false), DateOpen = table.Column(type: "datetime2", nullable: false), - DateClose = table.Column(type: "datetime2", nullable: false), + DateClose = table.Column(type: "datetime2", nullable: true), Status = table.Column(type: "int", nullable: false) }, constraints: table => diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/BankYouBancruptDatabaseModelSnapshot.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/BankYouBancruptDatabaseModelSnapshot.cs index 22b33a8..a730c1e 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/BankYouBancruptDatabaseModelSnapshot.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Migrations/BankYouBancruptDatabaseModelSnapshot.cs @@ -237,7 +237,6 @@ namespace BankYouBankruptDatabaseImplement.Migrations .HasColumnType("int"); b.Property("DateClose") - .IsRequired() .HasColumnType("datetime2"); b.Property("DateOpen") diff --git a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs index ad09706..cd606b8 100644 --- a/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs +++ b/BankYouBankrupt/BankYouBankruptDatabaseImplement/Models/Debiting.cs @@ -26,17 +26,16 @@ namespace BankYouBankruptDatabaseImplement.Models [Required] public DateTime DateOpen { get; set; } = DateTime.Now; - [Required] public DateTime? DateClose { get; set; } [Required] - public StatusEnum Status { get; set; } = StatusEnum.Открыта; + public StatusEnum Status { get; set; } public DebitingViewModel GetViewModel => new() { Id = Id, CardId = CardId, - CardNumber = Card == null ? string.Empty : Card.Number, + CardNumber = Card.Number, Sum = Sum, DateOpen = DateOpen, DateClose = DateClose,