Пример #1
0
        public ActionResult ReferPatient(int patientId)
        {
            int             thisDocId          = _identityProvider.GetAuthenticatedUserId();
            Patient         patient            = _patientManagementService.ViewPatient(patientId);
            List <Doctor>   allDoctors         = _doctorRepository.GetDoctors();
            List <Referral> referralsForDoctor = _referralRepository.GetReferralsForReferringDoctor(thisDocId).ToList();

            var referredDoctors = new List <Doctor>();

            foreach (Referral r in referralsForDoctor)
            {
                if (r.PatientId == patientId)
                {
                    referredDoctors.Add(_doctorRepository.GetDoctor(r.ReferredDoctorId));
                }
            }

            return(View(new ReferPatientViewModel {
                Patient = patient, Doctors = allDoctors, ReferredDoctors = referredDoctors
            }));
        }