public async Task <List <BoxItemDto> > ExecuteAsync(GetShipmentItems query) { var generatedItems = await context.BoxItems.ToListAsync(); var returnDtos = generatedItems.Select(x => mapper.Map <BoxItemDto>(x)).ToList(); return(returnDtos); }
public async Task <IActionResult> Generate() { var command = new GenerateShipmentItems { }; await commandBus.SendAsync(command); if (!command.Result) { return(StatusCode(500)); } var query = new GetShipmentItems { }; var result = await queryProcessor.ProcessAsync(query); if (result == null || !result.Any()) { return(StatusCode(500)); } return(Ok(result)); }
public List <BoxItemDto> Execute(GetShipmentItems query) { return(Task.Run(async() => { return await ExecuteAsync(query).ConfigureAwait(false); }).Result); }