/// <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)); } }
/// <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); }