Beispiel #1
0
        public async Task <IEnumerable <BankAccountsResponseDTO> > GetUserBankAccounts(GetUserBankAccountsDTO dto)
        {
            var bankAccounts = await _bankAccountRepository.GetAllByUser(dto.UserId);

            Validate.IsTrue(bankAccounts.Count() > 0, "No bank accounts were found");

            var bankAccountsDto = bankAccounts.Select(bk => new BankAccountsResponseDTO
            {
                Id            = bk.Id,
                Agency        = bk.Agency,
                AccountNumber = bk.Number,
                BankCode      = bk.Code,
                BankName      = BankCode.FromValue <BankCode>(bk.Code).Name,
                UserId        = (int)bk.UserId
            });

            return(bankAccountsDto);
        }