public JsonResult GetRx(string patientId) { ErrorResponse error = new ErrorResponse(); var response = new Dictionary <string, object>(); try { if (!string.IsNullOrEmpty(patientId)) { List <PatientRx> _result = lIPatientRxRepository.getPatientRxByPatientId(patientId); return(Json(new { Status = (int)HttpStatusCode.OK, Rxs = _result })); } else { error.ErrorCode = HttpStatusCode.InternalServerError; error.ErrorMessage = "Not found the patient details"; response.Add("ErrorResponse", error); return(Json(new { Status = (int)HttpStatusCode.InternalServerError, response })); } } catch (Exception ex) { logger.LogDebug("Get Rx Error: " + ex); error.ErrorCode = HttpStatusCode.InternalServerError; error.ErrorMessage = ex.ToString(); response.Add("ErrorResponse", error); return(Json(new { Status = (int)HttpStatusCode.InternalServerError, response })); } }