public HomePageViewModel(INavigationService navigationService, IAPIService APIservice, IPageDialogService dialogService) : base(navigationService) { LoggedStudent = Barrel.Current.Get <Student>("LoggedStudent"); StudentCourseList = new ObservableCollection <Course>(LoggedStudent.StudentCoursesList); OnMoreCommand = new DelegateCommand <Course>(async(param) => { SelectedItem = param; Barrel.Current.Add <Course>("SelectedCourse", SelectedItem, TimeSpan.FromSeconds(30)); await navigationService.NavigateAsync($"{NavConstants.CourseDetail}"); }); DeleteCourseCommand = new DelegateCommand <Course>(async(param) => { SelectedItem = (Course)param; if (await dialogService.DisplayAlertAsync("Confirm", $"Do you want to delete {SelectedItem.CourseName} from your schedule?", "Yes", "No")) { await APIservice.DeleteSchedule(LoggedStudent.StudentID, SelectedItem.CourseID); LoggedStudent.StudentCoursesList.Remove(SelectedItem); StudentCourseList.Remove(SelectedItem); Barrel.Current.Add <Student>("LoggedStudent", LoggedStudent, TimeSpan.FromMinutes(20)); } }); }