diff --git a/Bank/BankDatabaseImplement/Models/Withdrawal.cs b/Bank/BankDatabaseImplement/Models/Withdrawal.cs index 7639bcd..189b0af 100644 --- a/Bank/BankDatabaseImplement/Models/Withdrawal.cs +++ b/Bank/BankDatabaseImplement/Models/Withdrawal.cs @@ -86,16 +86,17 @@ namespace BankDatabaseImplement.Models context.SaveChanges(); foreach (var wa in WithdrawalAccounts) { + wa.Sum = model.WithdrawalAccounts[wa.AccountId].Item2; model.WithdrawalAccounts.Remove(wa.AccountId); } context.SaveChanges(); } - var Withdrawal = context.Withdrawals.First(x => x.Id == Id); + var withdrawal = context.Withdrawals.First(x => x.Id == Id); foreach (var account in model.WithdrawalAccounts) { context.AccountWithdrawals.Add(new AccountWithdrawal { - Withdrawal = Withdrawal, + Withdrawal = withdrawal, Account = context.Accounts.First(x => x.Id == account.Key), Sum = account.Value.Item2, });