Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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");
            }
        }
Ejemplo n.º 3
0
        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");
            }
        }
Ejemplo n.º 4
0
        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");
                }
            }
        }