// GET: Course
        public async Task <ActionResult> Index(int?SelectedDepartment, int?studentId)
        {
            ViewBag.StudentId = studentId;

            var departments = await departmentService.GetDepartmentsAsync();

            ViewBag.SelectedDepartment = new SelectList(departments, "DepartmentID", "Name", SelectedDepartment);
            int departmentID = SelectedDepartment.GetValueOrDefault();

            IQueryable <Course> courses = db.Courses
                                          .Where(c => !SelectedDepartment.HasValue || c.DepartmentID == departmentID)
                                          .OrderBy(d => d.CourseID)
                                          .Include(d => d.Department);

            return(View(courses.ToList()));
        }
        // GET: Departments
        public async Task <IActionResult> Index()
        {
            var departments = await departmentService.GetDepartmentsAsync();

            return(View(departments));
        }