public void EnrollInCourse(Course course) { if (EnrolledCourses.ContainsKey(course.Name)) { throw new DuplicateEntryInStructureException(UserName, course.Name); } enrolledCourses.Add(course.Name, course); }
public LearningViewModel(Pivot coursesPivot) { LoggedInUser = MainViewModel.LoggedInUser; _coursesPivot = coursesPivot; PivotItem enrollInCoursePivotItem = new PivotItem { Header = "Kurzusfelvétel", Content = new EnrollInCourse() }; _coursesPivot.Items.Add(enrollInCoursePivotItem); PivotItem enrolledCoursesPivotItem = new PivotItem { Header = "Felvett kurzusok" }; EnrolledCourses enrolledCoursesPage = new EnrolledCourses(); _coursesPivot.SelectionChanged += enrolledCoursesPage.RefreshEnrolledCourses; enrolledCoursesPivotItem.Content = enrolledCoursesPage; _coursesPivot.Items.Add(enrolledCoursesPivotItem); }