diff --git a/Bank/BankContracts/BindingModels/WithdrawalBindingModel.cs b/Bank/BankContracts/BindingModels/WithdrawalBindingModel.cs index 076bda7..3c99359 100644 --- a/Bank/BankContracts/BindingModels/WithdrawalBindingModel.cs +++ b/Bank/BankContracts/BindingModels/WithdrawalBindingModel.cs @@ -12,7 +12,6 @@ namespace BankContracts.BindingModels public int Id { get; set; } public DateTime WithdrawalTime { get; set; } = DateTime.Now; public int? RequestId { get; set; } - - public Dictionary WithdrawalAccounts = new Dictionary(); + public Dictionary WithdrawalAccounts { get; set; } = new(); } } diff --git a/Bank/BankContracts/ViewModels/WithdrawalViewModel.cs b/Bank/BankContracts/ViewModels/WithdrawalViewModel.cs index 1899a7c..037064f 100644 --- a/Bank/BankContracts/ViewModels/WithdrawalViewModel.cs +++ b/Bank/BankContracts/ViewModels/WithdrawalViewModel.cs @@ -16,6 +16,6 @@ namespace BankContracts.ViewModels public DateTime WithdrawalTime { get; set; } = DateTime.Now; [DisplayName("Номер заявки")] public int? RequestId { get; set; } - public Dictionary WithdrawalAccounts { get; set; } = new(); + public Dictionary WithdrawalAccounts { get; set; } = new(); } } diff --git a/Bank/BankDataModels/Models/IWithdrawalModel.cs b/Bank/BankDataModels/Models/IWithdrawalModel.cs index a8de01d..261f577 100644 --- a/Bank/BankDataModels/Models/IWithdrawalModel.cs +++ b/Bank/BankDataModels/Models/IWithdrawalModel.cs @@ -10,6 +10,6 @@ namespace BankDataModels.Models { DateTime WithdrawalTime { get; set; } int? RequestId { get; set; } - Dictionary WithdrawalAccounts { get; } + Dictionary WithdrawalAccounts { get; } } } diff --git a/Bank/BankDatabaseImplement/Models/AccountWithdrawal.cs b/Bank/BankDatabaseImplement/Models/AccountWithdrawal.cs index 448aaee..4a7dbad 100644 --- a/Bank/BankDatabaseImplement/Models/AccountWithdrawal.cs +++ b/Bank/BankDatabaseImplement/Models/AccountWithdrawal.cs @@ -14,6 +14,8 @@ namespace BankDatabaseImplement.Models public int AccountId { get; set; } [Required] public int WithdrawalId { get; set; } + [Required] + public int Sum { get; set; } public virtual Account Account { get; set; } = new(); public virtual Withdrawal Withdrawal { get; set; } = new(); } diff --git a/Bank/BankDatabaseImplement/Models/Withdrawal.cs b/Bank/BankDatabaseImplement/Models/Withdrawal.cs index 7641285..27146c7 100644 --- a/Bank/BankDatabaseImplement/Models/Withdrawal.cs +++ b/Bank/BankDatabaseImplement/Models/Withdrawal.cs @@ -21,15 +21,18 @@ namespace BankDatabaseImplement.Models public virtual Request? Request { get; set; } = null; [ForeignKey("WithdrawalId")] public virtual List Accounts { get; set; } = new(); - private Dictionary? _withdrawalAccounts { get; set; } = null; + private Dictionary? _withdrawalAccounts { get; set; } = null; [NotMapped] - public Dictionary WithdrawalAccounts + public Dictionary WithdrawalAccounts { get { if (_withdrawalAccounts == null) { - _withdrawalAccounts = Accounts.ToDictionary(x => x.AccountId, x => x.Account as IAccountModel); + _withdrawalAccounts = Accounts.ToDictionary( + x => x.AccountId, + x => (x.Account as IAccountModel, x.Sum) + ); } return _withdrawalAccounts; }