Ejemplo n.º 1
0
        private async Task <IEnumerable <BankAccountDoc> > AddBankAccounts(ProviderCreatingDto newProvider, String providerId)
        {
            IEnumerable <BankAccountDoc> accounts = new List <BankAccountDoc>();

            if (newProvider.BankAccounts.Any())
            {
                accounts = AutoMapper.Mapper.Map <IEnumerable <BankAccountDoc> >(newProvider.BankAccounts);
                foreach (var bankAccount in accounts)
                {
                    bankAccount.ProviderId   = providerId;
                    bankAccount.ProviderName = newProvider.Name;
                    bankAccount.UserId       = newProvider.UserId;
                }

                await _bankAccountRepository.AddAccounts(accounts);
            }

            return(accounts);
        }