public async Task Setup(PaymentsSetup setup) { for (int i = 0; i < setup.payments.Length; i += 10000) { var portion = setup.payments.Skip(i).Take(10000).ToArray(); var request = mapper.Map <PaymentsWriteMicroservice.SetupRequest>(new PaymentsSetup { payments = portion }); await paymentsWriteClient.SetupAppendAsync(request); } }
public async Task Setup(SetupAll setup) { var usersRequest = mapper.Map <UsersMicroservice.SetupRequest>(setup.UsersSetup); await usersClient.SetupAsync(usersRequest); var accountsRequest = mapper.Map <AccountsWriteMicroservice.SetupRequest>(setup.AccountsSetup); await accountsClient.SetupAsync(accountsRequest); var cardsRequest = mapper.Map <CardsWriteMicroservice.SetupRequest>(setup.CardsSetup); await cardsClient.SetupAsync(cardsRequest); for (int i = 0; i < setup.LoansSetup.loans.Length; i += 10000) { var portion = setup.LoansSetup.loans.Skip(i).Take(10000).ToArray(); var request = mapper.Map <LoansWriteMicroservice.SetupRequest>(new LoansSetup { loans = portion }); await loansClient.SetupAppendAsync(request); } for (int i = 0; i < setup.PaymentsSetup.payments.Length; i += 10000) { var portion = setup.PaymentsSetup.payments.Skip(i).Take(10000).ToArray(); var request = mapper.Map <PaymentsWriteMicroservice.SetupRequest>(new PaymentsSetup { payments = portion }); await paymentsClient.SetupAppendAsync(request); } for (int i = 0; i < setup.TransactionsSetup.transactions.Length; i += 10000) { var portion = setup.TransactionsSetup.transactions.Skip(i).Take(10000).ToArray(); var request = mapper.Map <TransactionsWriteMicroservice.SetupRequest>(new TransactionsSetup { transactions = portion }); await transactionsClient.SetupAppendAsync(request); } }