Beispiel #1
0
        public async Task <IActionResult> CustomerExists([FromRoute] string customerId)
        {
            var exists = await _customersRepository.Exists(customerId);

            if (!exists)
            {
                return(NotFound(new NotFoundErrorResponse($"customer with id {customerId}")));
            }

            return(Ok());
        }
Beispiel #2
0
        public async Task <IActionResult> UpdateCustomer([FromBody] CustomerPresenter model, CancellationToken cancellationToken = default)
        {
            if (!await customersRepository.Exists(model.Id, cancellationToken))
            {
                return(NotFound());
            }

            var customer = model.ToDomain();
            await customersRepository.Save(customer, cancellationToken);

            return(AcceptedAtAction("Get", new { id = customer.Id.Value }, model));
        }