示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
 public List <BoxItemDto> Execute(GetShipmentItems query)
 {
     return(Task.Run(async() => { return await ExecuteAsync(query).ConfigureAwait(false); }).Result);
 }