public void Standard(GetCustomerDetailsOutput getCustomerDetailsOutput) { List <AccountDetailsModel> accounts = new List <AccountDetailsModel>(); foreach (var account in getCustomerDetailsOutput.Accounts) { List <TransactionModel> transactions = new List <TransactionModel>(); foreach (var item in account.Transactions) { var transaction = new TransactionModel( item.Amount, item.Description, item.TransactionDate); transactions.Add(transaction); } accounts.Add(new AccountDetailsModel( account.AccountId, account.CurrentBalance, transactions)); } var getCustomerDetailsResponse = new GetCustomerDetailsResponse( getCustomerDetailsOutput.CustomerId, getCustomerDetailsOutput.SSN, getCustomerDetailsOutput.Name, accounts); ViewModel = new OkObjectResult(getCustomerDetailsResponse); }
public async Task Execute(GetCustomerDetailsInput input) { ICustomer customer = await _customerRepository.Get(input.CustomerId); if (customer == null) { _outputHandler.NotFound($"The customer {input.CustomerId} does not exist or is not processed yet."); return; } List <Boundaries.GetCustomerDetails.Account> accounts = new List <Boundaries.GetCustomerDetails.Account>(); foreach (Guid accountId in customer.Accounts.GetAccountIds()) { IAccount account = await _accountRepository.Get(accountId); if (account != null) { Boundaries.GetCustomerDetails.Account accountOutput = new Boundaries.GetCustomerDetails.Account(account); accounts.Add(accountOutput); } } GetCustomerDetailsOutput output = new GetCustomerDetailsOutput(customer, accounts); _outputHandler.Default(output); }
private void BuildOutput( ExternalUserId externalUserId, ICustomer customer, List <Boundaries.GetCustomerDetails.Account> accounts) { var output = new GetCustomerDetailsOutput( externalUserId, customer, accounts); this.outputPort.Standard(output); }
public void Default(GetCustomerDetailsOutput output) => GetCustomerDetails.Add(output);
private void BuildOutput(ICustomer customer, List <Boundaries.GetCustomerDetails.Account> accounts) { var output = new GetCustomerDetailsOutput(customer, accounts); _outputHandler.Standard(output); }
public void Standard(GetCustomerDetailsOutput output) { GetCustomerDetails.Add(output); }