/// <summary> /// New the account. /// </summary> /// <param name="personId">The person identifier.</param> /// <param name="balance">The balance.</param> /// <param name="typeId">The type identifier.</param> public void NewAccount(int personId, decimal balance, int typeId) { AccountBll temp = FactoryAccounts.CreateAccount(typeId, personId, generator.GenerateNumber(personId, balance, typeId), balance); accountRepository.Create(temp.ToDalAccount()); context.Save(); }
/// <summary> /// Closes the account. /// </summary> /// <param name="account">The account.</param> public void CloseAccount(AccountBll account) { Check(account); account.Close(); accountRepository.Update(account.ToDalAccount()); context.Save(); }
/// <summary> /// Transfers the specified account. /// </summary> /// <param name="account">The account.</param> /// <param name="transfer">The transfer.</param> /// <param name="count">The count.</param> public void Transfer(AccountBll account, AccountBll transfer, decimal count) { Check(account); Check(transfer); account.Withdraw(count); transfer.Deposit(count); accountRepository.Update(account.ToDalAccount()); accountRepository.Update(transfer.ToDalAccount()); context.Save(); }
/// <summary> /// Withdrawals the specified count. /// </summary> /// <param name="count">The count.</param> /// <param name="account">The account.</param> /// <exception cref="ArgumentException">count</exception> public void Withdrawal(decimal count, AccountBll account) { Check(account); if (count < 0) { throw new ArgumentException($"{nameof(count)} is less 0"); } account.Withdraw(count); accountRepository.Update(account.ToDalAccount()); context.Save(); }