This commit is contained in:
shadowik 2023-04-06 22:32:43 +04:00
parent b130e1ac99
commit 9b793348bf
2 changed files with 10 additions and 5 deletions

View File

@ -108,7 +108,15 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
{
throw new ArgumentNullException("Нет периода действия", nameof(model.Period));
}
var element = _cardStorage.GetElement(new CardSearchModel
{
Number = model.Number,
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Карта с таким ноиером уже есть");
}
_logger.LogInformation("Card. Number:{Number}.CVC:{CVC}.ClientId:{ClientID}.Patronymic:{Period}.Id:{Id}",
model.Number, model.CVC, model.Period.ToString(), model.ClientID, model.Id);
}

View File

@ -124,14 +124,11 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics
model.Name, model.Surname, model.Patronymic, model.Email, model.Password, model.Telephone, model.Id);
var element = _clientStorage.GetElement(new ClientSearchModel
{
Name = model.Name,
Surname = model.Surname,
Patronymic = model.Surname,
Email = model.Email,
});
if (element != null && element.Id != model.Id)
{
throw new InvalidOperationException("Клиент с таким именем уже есть");
throw new InvalidOperationException("Клиент с такой почтой уже есть");
}
}
}