public ActionResult GetAppointments(int id) { if (Convert.ToString(Session["key"]) != "labIncharge") { return(RedirectToAction("Login", "Home")); } Patient_Api patientApi = new Patient_Api(); IEnumerable <AppointmentModel> patientAppointments = patientApi.GetAppointments(id); ReportModel rptmOld = new ReportModel(); //if (patientAppointments) { foreach (var a in patientAppointments) { try { if (a.requestedReport) { rptmOld.appointmentIntIDs.Add(a.appointment_ID); } } catch (Exception ex) { string test = ex.ToString(); } } } LabIncharge_Api inchargeApi = new LabIncharge_Api(); var reportsModel = inchargeApi.GetPatientReports_Api(id); ReportModel rptmNew = new ReportModel(); foreach (var a in reportsModel) { { rptmNew.appointmentIntIDs.Add(a.appointment_ID); } } foreach (var a in rptmNew.appointmentIntIDs) { rptmOld.appointmentIntIDs.Remove(a); } foreach (var a in rptmOld.appointmentIntIDs) { rptmOld.appointmentIDs.Add(new SelectListItem { Text = a.ToString(), Value = a.ToString() }); } return(Json(rptmOld.appointmentIDs, JsonRequestBehavior.AllowGet)); }
public ActionResult ViewReportsByPatient(AppointmentModel app) { if (Convert.ToString(Session["key"]) != "doctor") { return(RedirectToAction("Login", "Home")); } LabIncharge_Api inchargeApi = new LabIncharge_Api(); var reportsModel = inchargeApi.GetPatientReports_Api(app.paitent_ID); return(View("~/Views/Doctor/DoctorManageReports.cshtml", reportsModel)); }
//[HttpPost] public ActionResult GetPatientReports(int id) { if (Convert.ToString(Session["key"]) != "labIncharge") { return(RedirectToAction("Login", "Home")); } LabIncharge_Api inchargeApi = new LabIncharge_Api(); var reportsModel = inchargeApi.GetPatientReports_Api(id); if (reportsModel != null) { return(View("~/Views/LabIncharge/LabInchargeViewReports.cshtml", reportsModel)); } // ErrorModel.ErrorMessage = "Unable to fetch Patient Reports Please try again"; return(View("~/Views/Error.cshtml")); }