public IActionResult HL7messageSendToServer(int exmiantionId) { try { var examination = _patientInfoRepository.GetExamination(exmiantionId); if (examination == null) { return(NotFound()); } var patient = _patientInfoRepository.GetPatient(examination.PatientId); if (patient == null) { return(NotFound()); } var examDetail = _patientInfoRepository.GetExaminationDetail(patient.Id, examination.Id); if (examDetail == null) { return(NotFound()); } Message msg = CreateHL7Message(examination, "2.3", patient, examDetail); string hl7msg = msg.Serialize(); HL7RequestInfo info = hL7CommunicationService.ParseHL7RawMessage(hl7msg, "Http"); SimpleMLLPClient client = new SimpleMLLPClient("localhost", 2021); //MLLPSession session = new MLLPSession(); var result = client.SendHL7Message(info.Message); _patientInfoRepository.UpdateExaminationStatus(exmiantionId, true); return(Ok()); } catch (Exception ex) { return(StatusCode(500, "Internal Server Error")); } }