static public void RegisterForCourse(HashSet <Course> course, Student student, semisterNames semister, SemisterYear year) { var program = Programs.Where(p => p.RegisredStudentsList.Contains(student)).FirstOrDefault(); if (program != null) // if student is enrolled in aprogram { var courseavaliable = DisplayCoursesForYearPerSemister(semister, year, program.ProgramName); //TO DO: check registrar policy for the maximum number of course registred at atime for a simister. if (!course.All(i => student.RegistredCourses.Contains(i)) && course.All(i => courseavaliable.Contains(i))) { student.RegistredCourses.Concat(course); } else { Console.WriteLine("you already registed for this course or not avaliable"); } } else { Console.WriteLine("please enroll in aprogramm"); } }
static public IEnumerable <Course> DisplayCoursesForYearPerSemister(semisterNames semister, SemisterYear year, programsNames program) { return(Programs.Where(p => p.ProgramName == program).FirstOrDefault().Courses.Where(c => c.semisterName == semister && c.Semisterbatch == year)); }