public void SaveEnrollment() { try { var enrollmentsDictionary = _enrollments.ToDictionary(p => p.EnrollmentId); if (SelectedEnrollment != null) { _enrollmentCommand.Upsert(SelectedEnrollment); Enrollments.Clear(); //Torlojuk a ListBox-ot Enrollments.AddRange(_enrollmentCommand.GetList()); //Megjelenitjuk benne az uj listat UpdateAppStatus("Enrollment saved."); } } catch (Exception ex) { UpdateAppStatus(ex.Message); } }
public MainViewModel() { SelectedEnrollment = _selectedEnrollment; try { _enrollmentCommand = new EnrollmentCommand(_connectionString); Enrollments.AddRange(_enrollmentCommand.GetList()); StudentCommand studentCommand = new StudentCommand(_connectionString); Students.AddRange(studentCommand.GetList()); CourseCommand courseCommand = new CourseCommand(_connectionString); Courses.AddRange(courseCommand.GetList()); } catch (Exception ex) { UpdateAppStatus(ex.Message); } }
public void SaveEnrollment() { try { var enrollmentDictionary = _enrollments.ToDictionary(x => x.EnrollmentId); if (SelectedEnrollment != null) { _enrollmentCommand.Upsert(SelectedEnrollment); Enrollments.Clear(); Enrollments.AddRange(_enrollmentCommand.GetList()); UpdateAppStatus("Enrollment Saved"); } } catch (Exception ex) { UpdateAppStatus(ex.Message); } }
public MainViewModel() { SelectedEnrollment = new EnrollmentModel(); try { //Ezekbol a Modellekbol csinaljuk itt, a ViewModellben a View szamara hasznalhato property-ket _enrollmentCommand = new EnrollmentCommand(_connectionString); Enrollments.AddRange(_enrollmentCommand.GetList()); StudentCommand studentCommand = new StudentCommand(_connectionString); Students.AddRange(studentCommand.GetList()); CourseCommand courseCommand = new CourseCommand(_connectionString); Courses.AddRange(courseCommand.GetList());//Adds a list from the DB to our list } catch (Exception ex) { //AppStatus = ex.Message; //Mindig, ha megvaltozik az AppStatus, akkor az AppStatus property ertesuljon rola. Alert the UI. (Lasd MainView.xaml, StatusBar) UpdateAppStatus(ex.Message); } }