示例#1
0
        /// <summary>
        /// Initializing an Instance
        /// </summary>
        /// <param name="accountStorage">Data store</param>
        public BankManager(IAccountStorage accountStorage)
        {
            _accountStorage = accountStorage ?? throw new System.ArgumentNullException(nameof(accountStorage));

            try
            {
                _accounts.AddRange(_accountStorage.GetBankAccounts().Select(acc => acc.ToAccount()));
            }
            catch (StorageException e)
            {
                throw new BankManagerException("There were problems reading from the repository.", e);
            }
        }
示例#2
0
 /// <summary>
 /// Get information about accounts <see cref="BankAccount"/>
 /// </summary>
 /// <exception cref="BankManagerException">
 /// It is thrown out in case of problems in the service.
 /// </exception>
 /// <returns>
 /// Information about accounts <see cref="BankAccount"/>
 /// </returns>
 public IEnumerable <BankAccount> GetAccounts()
 {
     return(_accountStorage.GetBankAccounts().Select(acc => acc.ToAccount()));
 }