public async Task <UpdateMedicalRecordRes> UpdateInternalMedicineExamination(InternalMedicineExamination result, string mRecordId) { try { var medicalRecordRaw = await _medicalRecordRepository.GetMedicalRecordById(mRecordId); if (medicalRecordRaw != null) { var medicalRecord = Helper.AutoDTO <MedicalRecord, MedicalRecordModel>(medicalRecordRaw); var user = _userService.GetUserById(medicalRecord.Details.InternalMedicineExamination.DoctorId); if (medicalRecord.Details.InternalMedicineExamination == null) { medicalRecord.Details.InternalMedicineExamination = result; } if (!medicalRecord.Details.InternalMedicineExamination.IsRegistered || user == null) { return(null); } if (user != null) { medicalRecordRaw.ServiceUsed++; } medicalRecord.Details.InternalMedicineExamination = result; FinishExamination(medicalRecordRaw); medicalRecordRaw.Details = Helper.AutoDTO <MedicalRecordDetails, string>(medicalRecord.Details); return(await _medicalRecordRepository.UpdateMedicalRecord(medicalRecordRaw)); } return(null); } catch (Exception) { return(null); } }
public async Task <IActionResult> UpdateInternalMedicineExamination([FromBody] InternalMedicineExamination result, string mRecordId) { var response = await _medicalRecordService.UpdateInternalMedicineExamination(result, mRecordId); if (response != null) { return(Ok(response)); } return(BadRequest()); }