示例#1
0
        public void RemoveCourse(Course courseToRemove)
        {
            bool courseIsFound = this.CourseExists(courseToRemove);

            if (!courseIsFound)
            {
                throw new ArgumentException("No such course found");
            }

            this.courses.Remove(courseToRemove);
        }
示例#2
0
        private bool CourseExists(Course courseToCheck)
        {
            bool isFound = false;

            foreach (var course in this.courses)
            {
                if (courseToCheck.CourseName == course.CourseName)
                {
                    isFound = true;
                }
            }

            return isFound;
        }
示例#3
0
 public void AddCourse(Course courseToAdd)
 {
     this.courses.Add(courseToAdd);
 }