Beispiel #1
0
        public async Task <IActionResult> DeleteCheckpointAsync([FromRoute] string id, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (!Guid.TryParse(id, out var guid))
            {
                var error = ErrorResponsesService.NotFoundError(Target, $"Checkpoint with id '{id}' not found.");
                return(NotFound(error));
            }

            try
            {
                await repository.RemoveAsync(guid, cancellationToken).ConfigureAwait(false);
            }
            catch (CheckpointNotFoundException ex)
            {
                var error = ErrorResponsesService.NotFoundError(Target, ex.Message);
                return(NotFound(error));
            }

            return(NoContent());
        }