Beispiel #1
0
        /// <summary>
        /// Getss all bank accounts in the repository
        /// </summary>
        /// <returns>Collection of all bank accounts in the repository</returns>
        public IEnumerable <BankAccount> GetAllAccounts()
        {
            var accounts = _repository.GetAll();

            foreach (var acc in accounts)
            {
                yield return(BankAccountMapper.DTOToBancAcc(acc));
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets account by its id
        /// </summary>
        /// <param name="id">Given id</param>
        /// <returns>Bank account with given id</returns>
        public BankAccount GetAccountById(int id)
        {
            var accounts = _repository.GetAll();

            foreach (var acc in accounts)
            {
                if (acc.Id == id)
                {
                    return(BankAccountMapper.DTOToBancAcc(acc));
                }
            }

            return(null);
        }