Ejemplo n.º 1
0
        private async void Delete(object obj)
        {
            if (SelectedSchool?.FId != null)
            {
                var isDeleteAccepted = await StandardMessagesDisplay.DeleteDisplayMessage(SelectedSchool.SchoolName);

                if (isDeleteAccepted)
                {
                    var deleteResponse = await DataService.Delete($"School/{Preferences.Get("TeamId", "")}/{SelectedSchool.FId}");

                    if (deleteResponse == "ConnectionError")
                    {
                        StandardMessagesDisplay.NoConnectionToast();
                    }
                    else if (deleteResponse == "Error")
                    {
                        StandardMessagesDisplay.Error();
                    }
                    else if (deleteResponse == "ErrorTracked")
                    {
                        StandardMessagesDisplay.ErrorTracked();
                    }
                    else if (deleteResponse == "null")
                    {
                        _ = await DataService.Put((--StaticDataStore.TeamStats.TotalSchools).ToString(), $"Team/{Preferences.Get("ClusterId", "")}/{Preferences.Get("TeamFId", "")}/TotalSchools");

                        StandardMessagesDisplay.ItemDeletedToast();

                        Schools?.Remove(SelectedSchool);
                    }
                }
                else
                {
                    return;
                }
            }
            else
            {
                StandardMessagesDisplay.NoItemSelectedDisplayMessage();
            }
        }