public PrescriptionPrintViewModel getPrescriptionDetailsForPrint(int prescriptiontID) { PrescriptionPrintViewModel prescriptionViewModel; using (Entities.Entities ctx = new Entities.Entities()) { Prescription prescriptionEntity = ctx.Prescriptions.Find(prescriptiontID); if (prescriptionEntity != null) { prescriptionViewModel = new PrescriptionPrintViewModel { PrescriptionID = prescriptionEntity.PrescriptionID, Notice = prescriptionEntity.Notice, DoctorName = prescriptionEntity.Doctor.Name, AppointmentDate = prescriptionEntity.Appointment.Start_date, Medicines = prescriptionEntity.Medicines.ToList(), patientName = prescriptionEntity.Patient.Name }; } else { prescriptionViewModel = null; } } return(prescriptionViewModel); }
// // GET: /DoctorDashboard/Prescription/PrescriptionDetails/5 public ActionResult PrescriptionDetails(int prescriptionID = 0) { if (prescriptionID == 0) { return(HttpNotFound()); } PrescriptionPrintViewModel prescription = prescriptionRepository.getPrescriptionDetailsForPrint(prescriptionID); if (prescription == null) { return(HttpNotFound()); } prescription.AppointmentDate = DateTime.Now; return(View(prescription)); }