public List <Patient> Patients() //sorted patients { List <Patient> PatientSortedList = new List <Patient>(); if (HowToSort == "Alphabetically") //sorted doctors by alphabetically { var sortAlph = PatientList.OrderBy(i => i.User.Lastname).ThenBy(i => i.User.Name).ThenBy(i => i.User.Patronymic); PatientSortedList = sortAlph.ToList(); } else if (HowToSort == "Birthday") { var sortByBirth = PatientList.OrderBy(i => i.User.Birthday); PatientSortedList = sortByBirth.ToList(); } else { PatientSortedList = CreateListOf.Patients(); } return(PatientSortedList); }