//************************************** // public EnrollFlags Enroll(Student s) { // First, make sure that this Student is not already // enrolled for this Section, has not already enrolled // in another section of this class and that he/she has // NEVER taken and passed the course before. Transcript transcript = s.Transcript; if (s.IsEnrolledIn(this) || s.IsCurrentlyEnrolledInSimilar(this) || transcript.VerifyCompletion(RepresentedCourse)) { return(EnrollFlags.PREVIOUSLY_ENROLLED); } // If there are any prerequisites for this course, // check to ensure that the Student has completed them. Course c = RepresentedCourse; if (c.HasPrerequisites()) { foreach (Course pre in c.Prerequisites) { // See if the Student's Transcript reflects // successful completion of the prerequisite. if (!transcript.VerifyCompletion(pre)) { return(EnrollFlags.PREREQ_NOT_SATISFIED); } } } // If the total enrollment is already at the // the capacity for this Section, we reject this // enrollment request. if (!ConfirmSeatAvailability()) { return(EnrollFlags.SECTION_FULL); } // If we made it to here in the code, we're ready to // officially enroll the Student. // Note bidirectionality: this Section holds // onto the Student via the Dictionary, and then // the Student is given an object reference to this Section. if (!EnrolledStudents.ContainsKey(s.Id)) { EnrolledStudents.Add(s.Id, s); } s.AddSection(this); return(EnrollFlags.SUCCESSFULLY_ENROLLED); }
public IActionResult Enroll(Student student) { if (ModelState.IsValid) { EnrolledStudents.Add(student); return(View("EnrollDone", student)); } return(View()); }
private void AddStudent() { mDataService.AddStudent(NewStudent); EnrolledStudents.Add(NewStudent); SelectedSection.StudentIds.Add(NewStudent.Id); mDataService.Save(); SelectedEnrolledStudent = NewStudent; NewStudent = new Student(string.Empty, string.Empty); }
private void EnrollStudent() { var theStudent = SelectedNonEnrolledStudent; SelectedSection.StudentIds.Add(theStudent.Id); mDataService.Save(); EnrolledStudents.Add(theStudent); NonEnrolledStudents.Remove(theStudent); SelectedEnrolledStudent = theStudent; }