Пример #1
0
        // GET: Patients/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Patient patient = db.Patients.SingleOrDefault(p => p.ID == id);

            if (patient == null)
            {
                return(HttpNotFound());
            }
            PatientTranslator    patientDeatilsTranslator = new PatientTranslator();
            PatientEditViewModel viewModel = patientDeatilsTranslator.ToPatientEditViewModel(patient);

            return(View(viewModel));
        }
Пример #2
0
        // GET: Patients/Edit/5
        public ActionResult Edit(int?id)

        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Patient patient = db.Patients
                              .Include(p => p.PersonalDoctor)
                              .SingleOrDefault(p => p.ID == id);

            if (patient == null)
            {
                return(HttpNotFound());
            }
            PatientTranslator    patientEditTranslator = new PatientTranslator();
            PatientEditViewModel viewModel             = new PatientEditViewModel();

            viewModel = patientEditTranslator.ToPatientEditViewModel(patient);
            viewModel.PersonalDoctorID = new SelectList(db.Doctors, "ID", "FullName", patient.PersonalDoctorID);
            return(View(viewModel));
        }