public async Task <ActionResult> Index(int?id, int?courseID)
        {
            var viewModel = new InstructorIndexDataViewModel();

            viewModel.Instructors = GetInstructorDetails().ToArray();

            if (id != null)
            {
                ViewBag.InstructorID = id.Value;
                viewModel.Courses    = viewModel.Instructors.Single(p => p.InstructorId == id).CourseDetails;
            }

            if (courseID != null)
            {
                ViewBag.CourseID      = courseID.Value;
                viewModel.Enrollments = await _QueryRepository.GetEntities <Enrollment>(
                    p => p.CourseID == courseID)
                                        .Select(p => new EnrollmentDetailViewModel
                {
                    FirstMidName = p.Student.FirstMidName,
                    LastName     = p.Student.LastName,
                    Grade        = p.Grade
                }).AsAsync();
            }

            return(View(viewModel));
        }
        public async Task<ActionResult> Index(int? id, int? courseID)
        {
            var viewModel = new InstructorIndexDataViewModel();
            viewModel.Instructors = GetInstructorDetails().ToArray();

            if (id != null)
            {
                ViewBag.InstructorID = id.Value;
                viewModel.Courses = viewModel.Instructors.Single(p => p.InstructorId == id).CourseDetails;
            }

            if (courseID != null)
            {
                ViewBag.CourseID = courseID.Value;
                viewModel.Enrollments = await _QueryRepository.GetEntities<Enrollment>(
                    p => p.CourseID == courseID)
                    .Select(p => new EnrollmentDetailViewModel
                    {
                        FirstMidName = p.Student.FirstMidName,
                        LastName = p.Student.LastName,
                        Grade = p.Grade
                    }).AsAsync();
            }

            return View(viewModel);
        }