Пример #1
0
        public async Task <IActionResult> InvoiceCustomer(InvoiceCustomerCommand command)
        {
            if (!await _customerDataService.CustomerExists(command.CustomerId))
            {
                return(NotFound("Customer"));
            }

            try {
                await _invoiceCustomerCommandHandler.Handle(command);

                return(NoContent());
            }
            catch (ValidationException exception) {
                return(BadRequest(exception.Errors));
            }
        }
Пример #2
0
        public async Task <IActionResult> AddContactDetailsForCustomer(Guid id, AddContactDetailsForCustomerCommand command)
        {
            if (!await _customerDataService.CustomerExists(id))
            {
                return(new NotFoundObjectResult("Customer"));
            }

            try {
                await _addContactDetailsForCustomerCommandHandler.Handle(command);

                return(NoContent());
            }
            catch (ValidationException exception) {
                return(BadRequest(exception.Errors));
            }
        }