public List <string> GetDoctorsByCriterion(int doctorSpecialization) { List <string> Doctors = new List <string>(); using (var context = new PolyclinicDBContext()) { int therapistId = iCRUDMethods.GetTherapistId(); var selectedDoctors = from d in context.Doctor.AsNoTracking() where d.Specialization == doctorSpecialization select d; foreach (Doctor doctor in selectedDoctors) { if (doctor.Specialization != therapistId) { Doctors.Add(String.Format("{0}.{1} {2} {3}; {4}; № кабинета {5}; Время приёма: {6}", doctor.DocId, doctor.LastName, doctor.FirstName, doctor.Patronymic, iCRUDMethods.GetSpecializationName(doctorSpecialization), doctor.Room, doctor.Shedule)); } else { Doctors.Add(String.Format("{0}.{1} {2} {3}; {4}; № кабинета {5}; № участка: {6}; Время приёма: {7}", doctor.DocId, doctor.LastName, doctor.FirstName, doctor.Patronymic, iCRUDMethods.GetSpecializationName(doctorSpecialization), doctor.Room, GetRegionName(doctor.Region.Value), doctor.Shedule)); } } } return(Doctors); }
public int GetTherapistId() { return(iCRUDMethods.GetTherapistId()); }