public ActionResult registerToStudent(string id, CoursesAvailabelToStudentViewModel CATS)
 {
     foreach (var item in CATS.coursesAvailableList)
     {
         student_available_course SAC = new student_available_course();
         SAC.course_ID  = context.courses.FirstOrDefault(c => c.course_name == item).course_code;
         SAC.student_ID = context.students.FirstOrDefault(s => s.student_ID == id).student_ID;
         context.student_available_course.Add(SAC);
         context.SaveChanges();
     }
     return(RedirectToAction("getStudent"));
 }
        public ActionResult ShowAllCoursesAvailable(string id)
        {
            //if (id != null)
            //{
            //    CoursesAvailabelToStudentViewModel CAS = new CoursesAvailabelToStudentViewModel();
            //    CAS.student = context.students.FirstOrDefault(s => s.student_ID == id);
            //    if (CAS.student != null)
            //    {
            //        if (CAS.student.student_level == 1)
            //        {
            //            CAS.coursesAvailable = context.courses.Where(l => l.course_level == 1 && l.course_semester == 1).ToList();
            //            return View(CAS);
            //        }
            //        else
            //        {
            //            int level = CAS.student.student_level;
            //            List<course> coursesAvailabale = (from c in context.courses
            //                                              where c.course_level == level
            //                                              select c).ToList();

            //        }
            //    }

            if (id != null)
            {
                CoursesAvailabelToStudentViewModel CAS2 = new CoursesAvailabelToStudentViewModel();
                CAS2.student = context.students.FirstOrDefault(s => s.student_ID == id);
                //if (CAS2.student != null)
                //{
                CAS2.coursesAvailable = (from c in context.student_available_course
                                         where c.student_ID == id
                                         select context.courses.FirstOrDefault(CA => CA.course_code == c.course_ID)).ToList();
                return(View(CAS2));
                //}
            }
            return(View("getStudent"));
        }