public async Task CreateAsync(Guid id, int maxRank) { var products = _productRepository.GetAllAsync(); var orders = _orderRepository.GetAllAsync(); await Task.WhenAll(products, orders); var report = _productsReportFactory.Create(id, products.Result.ToList(), orders.Result.ToList(), maxRank); await _productsReportRepository.AddAsync(report); }
public async Task HandleAsync(CreateProductsReport command, ICorrelationContext context) { var products = _productRepository.GetAllAsync(); var orders = _orderRepository.GetAllAsync(); await Task.WhenAll(products, orders); var report = _productsReportFactory.Create(command.Id, products.Result.ToList(), orders.Result.ToList(), command.MaxRank); await _productsReportRepository.AddAsync(report); }