Пример #1
0
        public async Task <IActionResult> PutAsync(int id, [FromBody] SaveDiagnosisResource resource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState.GetErrorMessages()));
            }

            var diagnosis = _mapper.Map <SaveDiagnosisResource, Diagnosis>(resource);
            var result    = await _diagnosisService.UpdateAsync(id, diagnosis);

            if (!result.Success)
            {
                return(BadRequest(result.Message));
            }

            var diagnosisResource = _mapper.Map <Diagnosis, DiagnosisResource>(result.Diagnosis);

            return(Ok(diagnosisResource));
        }
Пример #2
0
        public async Task <IActionResult> Post([FromBody] DiagnosisDto diagnosis)
        {
            await _diagnosisService.UpdateAsync(diagnosis);

            return(Success());
        }