//
        // GET: /InstructorManager/
        public ActionResult Index(Int32? id, Int32? courseID)
        {
            var viewModel = new InstructorIndexData();
            viewModel.Instructors = db.Instructors
                .Include(i => i.Courses.Select(c => c.Department))
                .OrderBy(i => i.InstructorName);
            if (id != null)
            {
                ViewBag.InstructorID = id.Value;
                viewModel.Courses = viewModel.Instructors.Where(i => i.UserID == id.Value).Single().Courses;
            }

            if (courseID != null)
            {
                ViewBag.CourseID = courseID.Value;
                viewModel.Enrollments = viewModel.Courses.Where(x => x.CourseId == courseID).Single().Enrollments;
            }

            return View(viewModel);
        }
        //
        // GET: /InstructorArea/ManageCourses/9
        public ActionResult ManageCourses(Int32? id, Int32? courseID)
        {
            var viewModel = new InstructorIndexData();
            /* viewModel.Instructors = db.Instructors
                 .Include(i => i.Courses.Select(c => c.Department))
                 .OrderBy(i => i.InstructorName); */
            User current = (User)Session["CurrentUser"];
            ViewBag.User = current.Email_ID;

            viewModel.CurrentInstructor = (from inst in db.Instructors
                                           where inst.Email_ID.Equals(current.Email_ID)
                                           select inst).FirstOrDefault();

            if (id != null)
            {
                ViewBag.InstructorID = id.Value;
                viewModel.Courses = viewModel.CurrentInstructor.Courses;
            }

            if (courseID != null)
            {
                ViewBag.CourseID = courseID.Value;
                viewModel.Enrollments = viewModel.Courses.Where(x => x.CourseId == courseID).Single().Enrollments;
            }

            return View(viewModel);
        }