예제 #1
0
        public async Task <ActionResult <CustomerViewModel> > Create([FromBody] CreateCustomerCommand command)
        {
            _logger.LogInformation(
                "----- Sending command: {CommandName}: {CommandId} ({@Command})",
                typeof(CreateCustomerCommand).Name,
                nameof(command.Name),
                command.Name,
                command);

            var customerId = await _mediator.Send(command);

            var customer = _queries.GetAsync(customerId);

            return(Created("", customer));
        }
예제 #2
0
 public Task <CustomerDto?> GetAsync(CustomerId id)
 {
     return(QueryAsync(
                Authorize.Unauthenticated,
                () => _customerQueries.GetAsync(id)
                ));
 }