public async Task LoadData() { IsBusy = true; Student.Clear(); List <Students> list = await UniversityServiceApi.GetItems <Students>("api/Students"); foreach (Students item in list) { Student.Add(item); } IsBusy = false; }
private async Task Add() { bool result = await UniversityServiceApi.AddItem <Students>(controller, st); if (result) { await App.Current.MainPage.DisplayAlert("Success!", "The Student Was Added Successfuly!", "Ok"); } else { await App.Current.MainPage.DisplayAlert("Failed!", "The Student Was NOT Added!", "Ok"); } }
private async Task Update() { bool result = await UniversityServiceApi.UpdateItem <Students>(controller, st, st.id); if (result) { await App.Current.MainPage.DisplayAlert("Success!", "The student was updated successfuly!", "Ok"); await App.Current.MainPage.Navigation.PopAsync(); } else { await App.Current.MainPage.DisplayAlert("Failed!", "The student was NOT updated!", "Ok"); } }
private async Task Delete() { bool confirm = await App.Current.MainPage.DisplayAlert("Please Confirm", "Do You Really Want to delete this Item", "Yes", "No"); if (confirm) { bool result = await UniversityServiceApi.DeleteItem <Students>(controller, st.id); if (result) { await App.Current.MainPage.DisplayAlert("Success!", "The student was Deleted successfuly!", "Ok"); await App.Current.MainPage.Navigation.PopAsync(); } else { await App.Current.MainPage.DisplayAlert("Failed!", "The student was NOT Deleted!", "Ok"); } } }