Exemple #1
0
        public async Task <IActionResult> GetCustomer(int id)
        {
            var query    = new GetSingleCustomerQuery(id);
            var response = await _mediator.Send(query);

            return(response != null ? (ActionResult)Ok(response) : NotFound());
        }
Exemple #2
0
        public async Task <ActionResult <Customer> > DeleteCustomer(int id)
        {
            var query    = new GetSingleCustomerQuery(id);
            var customer = await _mediator.Send(query);

            if (customer == null)
            {
                return(NotFound());
            }

            var command  = new DeleteCustomerCommand(id);
            var response = await _mediator.Send(command);

            return(response != null ? (ActionResult)Ok(response) : NotFound());
        }