コード例 #1
0
        public async Task <IActionResult> CreateCheckpointAsync([FromBody] Client.CheckpointCreationInfo creationInfo,
                                                                CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (creationInfo == null)
            {
                var error = ErrorResponsesService.BodyIsMissing(nameof(creationInfo));
                return(BadRequest(error));
            }

            var modelCreationInfo = Converter.CheckpointCreationInfoConverter.Convert(creationInfo);
            var modelCheckpoint   = await repository.CreateAsync(modelCreationInfo, cancellationToken).ConfigureAwait(false);

            var clientCheckpoint = Converter.CheckpointConverter.Convert(modelCheckpoint);

            return(CreatedAtRoute("GetCheckpointRoute", new { id = clientCheckpoint.Id }, clientCheckpoint));
        }