Example #1
0
        public void AddStudent(Student student)
        {
            if (this.students.Any(currentStudent => currentStudent.Id == student.Id))
            {
                throw new InvalidOperationException("Duplicated Id!");
            }

            this.students.Add(student);
        }
Example #2
0
        public void AddStudent(Student student)
        {
            if (!(this.students.Count < Course.Capacity))
            {
                throw new InvalidOperationException("Course is full!");
            }

            if (this.students.Contains(student))
            {
                throw new ArgumentException("Student already added!");
            }

            this.students.Add(student);
        }
Example #3
0
 public bool RemoveStudent(Student student)
 {
     return this.students.Remove(student);
 }