示例#1
0
        public IActionResult AllStudents()
        {
            var students = _dbContex.Students
                           .Include(s => s.Applicant)
                           .Include(s => s.StudentLessons)
                           .ThenInclude(sl => sl.Lesson)
                           .ThenInclude(l => l.Teacher)
                           .Include(s => s.StudentLessons)
                           .ThenInclude(sl => sl.Lesson)
                           .ThenInclude(l => l.Technology);

            List <StudentInfoViewModel> model = new List <StudentInfoViewModel>();

            foreach (var item in students)
            {
                model.Add(StudentMapper.Mapping(item));
            }

            return(View(model));
        }