コード例 #1
0
        async Task DeleteCourse()
        {
            var answer = await Application.Current.MainPage.DisplayAlert("Confirm", "Delete confirm", "Yes", "No");

            if (!answer)
            {
                return;
            }

            var connection = await courseService.CheckConnection();

            if (!connection)
            {
                await Application.Current.MainPage.DisplayAlert("Error", "No internet connection", "Cancel");

                return;
            }

            await courseService.Delete(Endpoints.DELETE_COURSES, this.CourseID);

            await Application.Current.MainPage.DisplayAlert("Message", "The process is successful", "Confirm");

            var courseViewModel = CoursesViewModel.GetInstance();
            var courseDeleted   = courseViewModel.AllCourses.FirstOrDefault(x => x.CourseID == this.CourseID);

            courseViewModel.AllCourses.Remove(courseDeleted);
            courseViewModel.GetCoursesByTitle();
        }
コード例 #2
0
        public MainViewModel()
        {
            instance = this;

            Courses           = new CoursesViewModel();
            CourseInstructors = new CourseInstructorsViewModel();
            CreateCourse      = new CreateCourseViewModel();
            Login             = new LoginViewModel();
            Home = new HomeViewModel();

            //Movies = new MoviesViewModel();

            CreateCourseCommand = new Command(async() => await GoToCreateCourse());
        }
コード例 #3
0
        public MainViewModel()
        {
            instance          = this;
            Courses           = new CoursesViewModel();
            CourseInstructors = new CourseInstructorsViewModel();
            Departments       = new DepartmentsViewModel();
            Students          = new StudentsViewModel();
            Instructors       = new InstructorsViewModel();
            Enrollments       = new EnrollmentsViewModel();
            OfficeAssignments = new OfficeAssignmentsViewModel();
            CreateCourse      = new CreateCourseViewModel();
            CreateStudent     = new CreateStudentViewModel();
            CreateInstructor  = new CreateInstructorViewModel();
            Login             = new LoginViewModel();
            Home = new HomeViewModel();

            CreateCourseCommand     = new Command(async() => await GoToCreateCourse());
            CreateInstructorCommand = new Command(async() => await GoToCreateInstructor());
            CreateStudentCommand    = new Command(async() => await GoToCreateStudent());
        }
コード例 #4
0
        public MainViewModel()
        {
            instance = this;

            Students          = new StudentsViewModel();
            Instructors       = new InstructorsViewModel();
            Courses           = new CoursesViewModel();
            CourseInstructors = new CourseInstructorsViewModel();

            Login = new LoginViewModel();
            Home  = new HomeViewModel();

            CreateCourse     = new CreateCourseViewModel();
            CreateStudent    = new CreateStudentViewModel();
            CreateInstructor = new CreateInstructorViewModel();

            //Movies = new MoviesViewModel();

            CreateCourseCommand     = new Command(async() => await GoToCreateCourse());
            CreateInstructorCommand = new Command(async() => await GoToCreateInstructor());
            CreateStudentCommand    = new Command(async() => await GoToCreateStudent());
        }