コード例 #1
0
        public async Task <IActionResult> Put([FromForm] MedicalExaminationView medicalExaminationView)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest("Invalid data."));
                }

                if (medicalExaminationView == null)
                {
                    return(BadRequest("medicalExaminationView is null"));
                }

                await _uploadFileAndSavePath.UloadFile(medicalExaminationView);

                if (_medicalExaminationRepository.UpdateFull(medicalExaminationView.ViewToEntity()))
                {
                    return(Ok());
                }

                return(NotFound());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
コード例 #2
0
        public async Task <IActionResult> Post([FromForm] PatientView patient)
        {
            try
            {
                if (patient == null)
                {
                    return(BadRequest("Owner object is null"));
                }

                if (!ModelState.IsValid)
                {
                    return(BadRequest("Invalid model object"));
                }
                await _uploadFileAndSavePath.UloadFile(patient);

                _patientRepository.InsertWithDefaultGeneralInformation(patient.ViewToEntity());

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error" + ex.Message));
            }
        }
コード例 #3
0
        public async Task <IActionResult> Put([FromForm] InjuriesDiseasesView injuriesDiseasesView)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest("Invalid data."));
                }

                await _uploadFileAndSavePath.UloadFile(injuriesDiseasesView);

                if (_injuriesDiseasesRepository.UpdateFull(injuriesDiseasesView.ViewToEntity()))
                {
                    return(Ok());
                }

                return(NotFound());
            }
            catch
            {
                return(BadRequest());
            }
        }