public IEnumerable <Doctor> SearchToAssign(ClassificationOfDoctors classification) { var result = _context.Doctors.Where(d => (classification == 0 || d.Specialty == classification) && (d.Deleted == false)).Where(r => r.Role == EnumForMedicRole.Doctor).ToList(); return(result); }
public IEnumerable <Patient> SearchPatientForHospitalStaff(Patient patient, int page, int size, int sortIndex, ClassificationOfDoctors classification) { Func <Patient, object> func = p => p.Id; if (sortIndex == 1) { func = p => p.DateOfBirth; } if (sortIndex == 2) { func = p => p.Surname + p.Name; } var result = _context.Patients .Where(s => s.HistoryIllnesses.Where(i => i.Doctor.Specialty == classification && string.IsNullOrEmpty(i.FinalDiagnosis)).Count() > 0) .Where(x => (string.IsNullOrEmpty(patient.Name) || x.Name == patient.Name) && (string.IsNullOrEmpty(patient.Surname) || x.Surname == patient.Surname) && (patient.DateOfBirth.Equals(DateTime.MinValue) || x.DateOfBirth == patient.DateOfBirth) ) .OrderBy(func) .Skip((page - 1) * size) .Take(size).ToList(); return(result); }