fix Withdrawal.UpdateAccounts

This commit is contained in:
Zakharov_Rostislav 2024-05-26 21:49:18 +04:00
parent 24299f86ce
commit b8b4fb24e5

View File

@ -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,
});