Exemple #1
0
        public ActionResult ChangeDoctor(int id)
        {
            var patient = new ChangeDoctorViewModel
            {
                Id = id, Doctors = GetDoctorListForPatientsViewModel(_doctorService.GetDoctors())
            };

            return(View(patient));
        }
Exemple #2
0
        public ActionResult ChangeDoctor(ChangeDoctorViewModel patientvm)
        {
            if (!ModelState.IsValid)
            {
                patientvm.Doctors = GetDoctorListForPatientsViewModel(_doctorService.GetDoctors());
                return(View(patientvm));
            }
            var patient = _patientService.FindById(patientvm.Id).First();

            if (patient == null)
            {
                return(HttpNotFound());
            }
            patient.DoctorId = patientvm.DoctorId;
            _patientService.ChangeDoctor(patient);
            _loggerService.Info($"{User.Identity.Name} changed patients {patient.FirstName} {patient.LastName} (doctor changed) ");
            return(RedirectToAction("Details", "Patient", new { id = patientvm.Id }));
        }