Example #1
0
        public string SignUpStudents(string studentName)
        {
            string output = "";

            if (enrolledStudents.Count < MaximunStudents)
            {
                enrolledStudents.Add(studentName);
                output = $"{studentName} was enrolled in {CourseTitle}.";

                if (enrolledStudents.Count == MaximunStudents)
                {
                    EnrollmentFull?.Invoke(this, $"{CourseTitle} enrollment is now full.");
                }
            }
            else
            {
                waitingList.Add(studentName);
                output = $"{studentName} was added to the waiting list in {CourseTitle}.";
            }

            return(output);
        }
Example #2
0
            public string SignUpStudent(string studentName)
            {
                string output = "";

                if (enrolledStudents.Count < MaxStudents)
                {
                    enrolledStudents.Add(studentName);
                    output = $"{studentName} was added to the enrolled list";

                    if (this.enrolledStudents.Count == MaxStudents)
                    {
                        // check if class is full
                        EnrollmentFull?.Invoke(this, $"{this.CourseTitle} is full");
                    }
                }
                else
                {
                    waitingList.Add(studentName);
                    output = $"{studentName} was added to the waiting list";
                }
                return(output);
            }
Example #3
0
        public string SignUpStudents(string studentName)
        {
            string output = "";

            if (enrolledStudents.Count <= MaximumStudents)
            {
                if (enrolledStudents.Count == MaximumStudents)
                {
                    EnrollmentFull?.Invoke(this, $"The enrollment has been full for {CourseTitle}");
                }

                enrolledStudents.Add(studentName);
                output = $"{studentName} was addedd to enrolled list for {CourseTitle} course";
            }

            else
            {
                waitingLists.Add(studentName);
                output = $"{studentName} was addedd to watiing list for {CourseTitle} course";
            }

            return(output);
        }