Оно работает. Но странно

This commit is contained in:
Programmist73 2023-05-14 16:34:14 +04:00
parent 1c273157d1
commit 5fd23d0bc0
10 changed files with 454 additions and 9 deletions

View File

@ -18,7 +18,7 @@ namespace BankYouBankruptContracts.BindingModels
public DateTime DateOpen { get; set; } = DateTime.Now;
public DateTime DateClose { get; set; }
public DateTime? DateClose { get; set; }
public StatusEnum Status { get; set; }
}

View File

@ -25,7 +25,7 @@ namespace BankYouBankruptContracts.ViewModels
public DateTime DateOpen { get; set; } = DateTime.Now;
[DisplayName("Дата закрытия заявки")]
public DateTime DateClose { get; set; }
public DateTime? DateClose { get; set; }
[DisplayName("Статус заявки")]
public StatusEnum Status { get; set; }

View File

@ -12,6 +12,6 @@ namespace BankYouBankruptContracts.ViewModels
public double SumOperation { get; set; }
public DateTime DateComplite { get; set; }
public DateTime? DateComplite { get; set; }
}
}

View File

@ -16,7 +16,7 @@ namespace BankYouBankruptDataModels.Models
DateTime DateOpen { get; }
DateTime DateClose { get; }
DateTime? DateClose { get; }
StatusEnum Status { get; }
}

View File

@ -0,0 +1,421 @@
// <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("20230514120539_support")]
partial class support
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("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>("Date")
.HasColumnType("datetime2");
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")
.IsRequired()
.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>("AccountSenderId")
.HasColumnType("int");
b.Property<DateTime>("DateOperation")
.HasColumnType("datetime2");
b.Property<int>("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
}
}
}

View File

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BankYouBankruptDatabaseImplement.Migrations
{
/// <inheritdoc />
public partial class support : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@ -236,7 +236,8 @@ namespace BankYouBankruptDatabaseImplement.Migrations
b.Property<int>("CardId")
.HasColumnType("int");
b.Property<DateTime>("DateClose")
b.Property<DateTime?>("DateClose")
.IsRequired()
.HasColumnType("datetime2");
b.Property<DateTime>("DateOpen")

View File

@ -26,7 +26,7 @@ namespace BankYouBankruptDatabaseImplement.Models
public int ClientId { get; set; }
//для передачи ФИО клиента
public virtual Client Client { get; set; }
public virtual Client Client { get; set; } = new();
[Required]
public string PasswordAccount { get; set; } = string.Empty;

View File

@ -18,7 +18,7 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required]
public int ClientID { get; set; }
public virtual Client Client { get; set; }
public virtual Client Client { get; set; } = new();
[Required]
public int AccountId { get; set; }

View File

@ -27,7 +27,7 @@ namespace BankYouBankruptDatabaseImplement.Models
public DateTime DateOpen { get; set; } = DateTime.Now;
[Required]
public DateTime DateClose { get; set; }
public DateTime? DateClose { get; set; }
[Required]
public StatusEnum Status { get; set; } = StatusEnum.Открыта;
@ -52,7 +52,6 @@ namespace BankYouBankruptDatabaseImplement.Models
Card = context.Cards.First(x => x.Id == model.CardId),
Sum = model.Sum,
DateOpen = model.DateOpen,
DateClose = model.DateClose,
Status = model.Status
};
}
@ -60,6 +59,8 @@ namespace BankYouBankruptDatabaseImplement.Models
public void Update(DebitingBindingModel model)
{
DateClose = model.DateClose;
Status = model.Status;
}
}
}