Правка сущности "Перевод денег".

This commit is contained in:
Programmist73 2023-05-16 20:51:29 +04:00
parent 191d34b8a5
commit 206c85f876
4 changed files with 45 additions and 10 deletions

View File

@ -13,10 +13,14 @@ namespace BankYouBankruptContracts.BindingModels
public int Sum { get; set; }
public int AccountSenderId { get; set; }
public int? AccountSenderId { get; set; }
public int AccountPayeeId { get; set; }
public DateTime DateOperation { get; set; } = DateTime.Now;
public int? CreditingId { get; set; }
public int CashierId { get; set; }
}
}

View File

@ -15,17 +15,25 @@ namespace BankYouBankruptContracts.ViewModels
[DisplayName("Сумма перевода")]
public int Sum { get; set; }
public int AccountSenderId { get; set; }
public int? AccountSenderId { get; set; }
[DisplayName("Номер счёта отп.")]
public int AccountSenderNumber { get; set; }
public string AccountSenderNumber { get; set; } = string.Empty;
public int AccountPayeeId { get; set; }
[DisplayName("Номер счёта получ.")]
public int AccountPayeeNumber { get; set; }
public string AccountPayeeNumber { get; set; } = string.Empty;
[DisplayName("Дата операции")]
public DateTime DateOperation { get; set; } = DateTime.Now;
[DisplayName("Номер операции на пополнение")]
public int? CreditingId { get; set; }
public int CashierId { get; set; }
[DisplayName("Фамилия кассира")]
public string CashierSurname { get; set; } = string.Empty;
}
}

View File

@ -11,10 +11,14 @@ namespace BankYouBankruptDataModels.Models
{
int Sum { get; }
int AccountSenderId { get; }
int? AccountSenderId { get; }
int AccountPayeeId { get; }
DateTime DateOperation { get; }
int? CreditingId { get; }
int CashierId { get; }
}
}

View File

@ -19,7 +19,7 @@ namespace BankYouBankruptDatabaseImplement.Models
public int Sum { get; set; }
[Required]
public int AccountSenderId { get; set; }
public int? AccountSenderId { get; set; }
[Required]
public int AccountPayeeId { get; set; }
@ -27,12 +27,26 @@ namespace BankYouBankruptDatabaseImplement.Models
[Required]
public DateTime DateOperation { get; set; }
[Required]
public int? CreditingId { get; set; }
public int CashierId { get; set; }
public virtual Cashier Cashier { get; set; }
public virtual Account AccountSender { get; set; }
public virtual Account AccountPayeer { get; set; }
public static MoneyTransfer Create(BankYouBancruptDatabase context, MoneyTransferBindingModel model)
{
return new MoneyTransfer()
{
Id = model.Id,
Sum = model.Sum,
Cashier = context.Cashiers.First(x => x.Id == model.CashierId),
AccountSender = context.Accounts.First(x => x.Id == model.AccountSenderId),
AccountPayeer = context.Accounts.First(x => x.Id == model.AccountPayeeId),
AccountSenderId = model.AccountSenderId,
AccountPayeeId = model.AccountPayeeId,
DateOperation = model.DateOperation
@ -50,8 +64,13 @@ namespace BankYouBankruptDatabaseImplement.Models
Id = Id,
AccountPayeeId = AccountPayeeId,
AccountSenderId = AccountSenderId,
AccountPayeeNumber = AccountPayeer.AccountNumber,
AccountSenderNumber = AccountSender.AccountNumber,
DateOperation = DateOperation,
Sum = Sum
Sum = Sum,
CreditingId = CreditingId,
CashierId = CashierId,
CashierSurname = Cashier.Surname
};
}
}