private Services.ClassRoom GetClassroom(ProfScreenViewModel model) { var classes = _classroomRepository.GetAllClassrooms().OrderBy(c => c.className); var students = _studentRepository.GetAllStudents().OrderBy(s => s.classId); model = new ProfScreenViewModel() { Classrooms = classes.ToList(), Students = students.ToList() }; string className = model.Classrooms.ElementAt(model.classId).className; string orgName = model.Classrooms.ElementAt(model.classId).orgName; int classId = _classroomRepository.GetIdByName(className); IEnumerable <Models.Students.Student> ClassStudents = _studentRepository.GetAllStudentsInClass(classId); List <Models.Students.Student> studentList = ClassStudents.ToList(); ObservableCollection <Services.Student> classStuds = new ObservableCollection <Services.Student>(); foreach (Models.Students.Student s in studentList) { Services.Student tempStudent = new Services.Student(s.name, s.githubUrsName, s.githubEmail); classStuds.Add(tempStudent); } return(new Services.ClassRoom(orgName, className, classStuds)); }