// GET: Courses
        public async Task <IActionResult> Index(int?CourseSemester, string CourseProgram, string SearchList)
        {
            //var universityContext = _context.Course.Include(c => c.FirstTeacher).Include(c => c.SecondTeacher).Include(n => n.Students).ThenInclude(n => n.Student); //dodadeno e .Include(n => n.Students).ThenInclude(n => n.Student)

            IQueryable <Course> courses        = _context.Course.AsQueryable();
            IQueryable <int>    semesterQuery  = _context.Course.OrderBy(m => m.Semester).Select(m => m.Semester).Distinct();   // dodadov (IQueryable<string>) inaku mi javuva greshka
            IQueryable <string> programmeQuery = _context.Course.OrderBy(m => m.Programme).Select(m => m.Programme).Distinct(); // dodadov (IQueryable<string>) inaku mi javuva greshka

            if (!string.IsNullOrEmpty(SearchList))
            {
                courses = courses.Where(s => s.Title.Contains(SearchList)); // ako go sodr\i soodvetniot naslov
            }

            if (CourseSemester != null)
            {
                courses = courses.Where(s => s.Semester == CourseSemester);
            }
            if (!string.IsNullOrEmpty(CourseProgram))
            {
                courses = courses.Where(s => s.Programme == CourseProgram);
            }

            courses = courses.Include(c => c.FirstTeacher).Include(c => c.SecondTeacher).Include(n => n.Students).ThenInclude(n => n.Student);

            var CourseVM = new CourseSearchViewModel
            {
                Semesters = new SelectList(await semesterQuery.ToListAsync()),
                Programs  = new SelectList(await programmeQuery.ToListAsync()),
                Courses   = await courses.ToListAsync()
            };

            return(View(CourseVM));
        }
        // GET: Courses
        public async Task <IActionResult> Index(string searchtitle, string searchprogramme, int searchsemmester)
        {
            IQueryable <Course> courses = _context.Course.AsQueryable();

            courses = _context.Course.Include(c => c.FirstTeacher).Include(c => c.SecondTeacher).Include(m => m.Students).ThenInclude(m => m.Student);


            if (!string.IsNullOrEmpty(searchtitle))
            {
                courses = courses.Where(s => s.Title.Contains(searchtitle));
            }
            if (searchsemmester != 0)
            {
                courses = courses.Where(x => x.Semester.Equals(searchsemmester));
            }
            if (!string.IsNullOrEmpty(searchprogramme))
            {
                courses = courses.Where(s => s.Programme.Contains(searchprogramme));
            }


            var courseSearchVM = new CourseSearchViewModel
            {
                Courses   = await courses.ToListAsync(),
                title     = searchtitle,
                programme = searchprogramme,
                semmester = searchsemmester
            };

            return(View(courseSearchVM));
        }