示例#1
0
        public PrescriptionPresnetViewModel getPrescriptionDetails(int prescriptiontID)
        {
            PrescriptionPresnetViewModel prescriptionViewModel;

            using (Entities.Entities ctx = new Entities.Entities())
            {
                Prescription prescriptionEntity = ctx.Prescriptions.Find(prescriptiontID);
                if (prescriptionEntity != null)
                {
                    prescriptionViewModel = new PrescriptionPresnetViewModel
                    {
                        PrescriptionID  = prescriptionEntity.PrescriptionID,
                        Notice          = prescriptionEntity.Notice,
                        DoctorName      = prescriptionEntity.Doctor.Name,
                        MedicineName    = prescriptionEntity.Medicine.Name,
                        AppointmentDate = prescriptionEntity.Appointment.Start_date,
                        Dose            = prescriptionEntity.Dose
                    };
                }
                else
                {
                    prescriptionViewModel = null;
                }
            }
            return(prescriptionViewModel);
        }
示例#2
0
        //public ActionResult PrescriptionCreate(int patientID = 0)
        //{
        //    if (patientID == 0)
        //        patientID = getCurrentPatientID();

        //    var medList = medicineRepository.getMedicineList();
        //    var applist = appointmentRepository.getPatientAppountmentList(patientID);
        //    PrescriptionWrapViewModel prescriptionWrapViewModel = new PrescriptionWrapViewModel { appointmentList = applist, MedicineList = medList };

        //    return View(prescriptionWrapViewModel);
        //}

        //[HttpPost]
        //public ActionResult PrescriptionCreate(PrescriptionViewModel prescriptionViewModel)
        //{
        //    try
        //    {
        //        if (ModelState.IsValid && prescriptionViewModel.MedicineID != 0 && prescriptionViewModel.AppointmentID != 0)
        //        {
        //            prescriptionViewModel.DoctorID = getDoctorIDbyUserID();
        //            prescriptionViewModel.PatientID = getCurrentPatientID();
        //            bool check = prescriptionRepository.addNewPrescription(prescriptionViewModel);
        //        }
        //        else
        //        {
        //            var medList = medicineRepository.getMedicineList();
        //            var applist = appointmentRepository.getPatientAppountmentList(getCurrentPatientID());
        //            PrescriptionWrapViewModel prescriptionWrapViewModel = new PrescriptionWrapViewModel { appointmentList = applist, MedicineList = medList };
        //            return View(prescriptionWrapViewModel);
        //        }

        //        return RedirectToAction("PrescriptionList", new { patientID = prescriptionViewModel.PatientID });
        //    }
        //    catch
        //    {
        //        ViewBag.patientID = prescriptionViewModel.PatientID;
        //        return View();
        //    }
        //}

        public ActionResult PrescriptionDelete(int prescriptionID)
        {
            PrescriptionPresnetViewModel prescriptionViewModel = prescriptionRepository.getPrescriptionDetails(prescriptionID);

            if (prescriptionViewModel == null)
            {
                return(HttpNotFound());
            }
            return(View(prescriptionViewModel));
        }