diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs index 619e234..f115dc6 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/AccountLogic.cs @@ -198,8 +198,8 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics throw new ArgumentNullException("Отсутствие номера у счёта", nameof(model.AccountNumber)); } - //проверка на наличие id владельца - if (model.CashierId < 0) + //проверка на наличие id владельца + if (model.CashierId < 0) { throw new ArgumentNullException("Некорректный Id владельца счёта", nameof(model.CashierId)); } @@ -211,11 +211,15 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics } //проверка на наличие пароля счёта - if (string.IsNullOrEmpty(model.PasswordAccount)) + if (string.IsNullOrEmpty(model.PasswordAccount) ) { throw new ArgumentNullException("Некорректный пароль счёта", nameof(model.PasswordAccount)); } + if (model.Balance < 0) { + throw new ArgumentNullException("Изначальный баланс аккаунта не может быть < 0", nameof(model.Balance)); + } + //проверка на корректную дату открытия счёта if (model.DateOpen > DateTime.Now) { diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs index cf26784..c75ed55 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CardLogic.cs @@ -131,13 +131,13 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics { return; } - if (string.IsNullOrEmpty(model.Number)) + if (string.IsNullOrEmpty(model.Number) || model.Number.Length != 16) { - throw new ArgumentNullException("Нет номера карты", nameof(model.Number)); + throw new ArgumentNullException("Неправильный номер карты", nameof(model.Number)); } - if (string.IsNullOrEmpty(model.CVC)) + if (string.IsNullOrEmpty(model.CVC) || model.CVC.Length != 16) { - throw new ArgumentNullException("Нет СVC карты", nameof(model.CVC)); + throw new ArgumentNullException("Неправильный СVC карты", nameof(model.CVC)); } if (model.Period < DateTime.Now) { diff --git a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs index 6fb7a0e..1acf6f4 100644 --- a/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs +++ b/BankYouBankrupt/BankYouBankruptBusinessLogic/BusinessLogics/CreditingLogic.cs @@ -138,6 +138,7 @@ namespace BankYouBankruptBusinessLogic.BusinessLogics return false; } + return true; } } diff --git a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CreateAccount.cshtml b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CreateAccount.cshtml index 1b80969..58721cb 100644 --- a/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CreateAccount.cshtml +++ b/BankYouBankrupt/BankYouBankruptCashierApp/Views/Home/CreateAccount.cshtml @@ -50,5 +50,5 @@ } document.getElementById("accountNumber").value = createNum(16); - document.getElementById("cvc").value = createNum(4); + document.getElementById("password").value = createNum(4); \ No newline at end of file