Exemplo n.º 1
0
        public async Task <IActionResult> AddWhiteBloodCellCountObservationAsync([Required] string patientId, [Required] decimal value)
        {
            Logger.LogDebug(nameof(AddWhiteBloodCellCountObservationAsync));
            if (ModelState.IsValid)
            {
                var response = await _observationService.AddWhiteBloodCellCountObservationAsync(patientId, value).ConfigureAwait(false);

                if (response == null)
                {
                    return(NotFound(new NotFoundError("The observation was not created")));
                }
                var result = _observationToDtoConverter.Convert(response);
                return(Ok(result));
            }
            else
            {
                var errors = ModelStateErrors();
                return(BadRequest(errors));
            }
        }