Exemplo n.º 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));
        }
Exemplo n.º 2
0
 public Task <CustomerDto?> GetAsync(CustomerId id)
 {
     return(QueryAsync(
                Authorize.Unauthenticated,
                () => _customerQueries.GetAsync(id)
                ));
 }