Untitled

mail@pastecode.io avatar
unknown
plain_text
16 days ago
1.6 kB
7
Indexable
Never
  protected override async void OnAppearing()

  {
      base.OnAppearing();
      await FillList();
  }

  private async Task FillList()
  {
      ListStudents.ItemsSource = await _Course.GetCourses();
  }

  private async void ItemEdit_OnInvoked(object sender, EventArgs e)
  {
      var item = sender as SwipeItemView;
      if (item == null) return;
      if (item.BindingContext is Course details)
      {

          var a = await _Course.GetCourseKey(details.coursecode);
          await Navigation.PushAsync(new editcourse());

      }

  }


  private async void ItemDelete_OnInvoked(object sender, EventArgs e)
  {
      var item = sender as SwipeItemView;
      if (!(item?.BindingContext is Course getCoursecode)) return;
      coursecode1 = getCoursecode.coursecode;
      if (!await DisplayAlert("Delete Student",
              "You are about to Delete the student. All associated data from your account with this student will be removed. You will have to enter the class again when you decide to comeback." +
              "Do you really want to leave?", "Yes", "No")) return;
      //  progressLoading.IsVisible = true;
      var a = await _Course._DeleteCourse(coursecode1);
      if (a)
      {

          await DisplayAlert("Succesfullly Deleted", "The student was Successfully Deleted", "Confirm");
          base.OnAppearing();
          await FillList();
      }
      else
      {
          await DisplayAlert("Deletion Failed", "The student was not Deleted", "Okay ");
      }

  }
Leave a Comment