Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
            }
        }