Artyom_Yashin 2024-04-28 23:23:31 +04:00
commit 1f91bd744a
3 changed files with 3 additions and 2 deletions

View File

@ -99,7 +99,7 @@ namespace BankBusinessLogic.BusinessLogic
_logger.LogInformation("Account. Number: {Number}. ManagerId: {ManagerId}. Id: {Id} ",
model.Number, model.ManagerId, model.Id);
var element = _accountStorage.GetElement(new AccountSearchModel { Number = model.Number });
if (element != null)
if (element != null && element.Id != model.Id)
throw new InvalidOperationException("Счет с таким номером уже есть");
}
}

View File

@ -102,7 +102,7 @@ namespace BankBusinessLogic.BusinessLogic
_logger.LogInformation("Manager. FIO:{FIO}. Email:{ Email}. Password:{ Password}. Id: { Id} ",
model.Fio, model.Email, model.Password, model.Id);
var element = _managerStorage.GetElement(new ManagerSearchModel { Email = model.Email });
if (element != null)
if (element != null && element.Id != model.Id)
throw new InvalidOperationException("Менеджер с таким Email уже есть");
}
}

View File

@ -80,6 +80,7 @@ namespace BankDatabaseImplement.Models
{
Withdrawal = Withdrawal,
Account = context.Accounts.First(x => x.Id == account.Key),
Sum = account.Value.Item2,
});
context.SaveChanges();
}