Пример #1
0
        private MentorDetailsViewModel GetMentorDetails(int id)
        {
            var mentor           = _mentorDAO.FetchAllRecords().FirstOrDefault(m => m.Id == id);
            var mentorClassrooms = _classEnrolmentDAO.FetchAllRecordsJoin().Where(ce => ce.MentorCE.Id == id).Select(ce => ce.ClassroomCE).ToList();
            var mentorGroups     = _groupDAO.FetchAllRecordsByIdJoin(id).GroupBy(g => g.Id).Select(g => g.FirstOrDefault()).ToList();
            var mentorStudents   = _studentDAO.FetchAllRecordsByIdJoin(id);
            var mentorViewModel  = new MentorDetailsViewModel
            {
                Mentor     = mentor,
                Classrooms = mentorClassrooms,
                Groups     = mentorGroups,
                Students   = mentorStudents
            };

            return(mentorViewModel);
        }