Esempio n. 1
0
        protected async override void OnAppearing()
        {
            base.OnAppearing();

            IEnumerable <Party> parties = await dbTransaction.GetParties();

            if (_partyType != null)
            {
                parties = parties.Where(x => x.PartyType == _partyType);
            }

            _partiesFromDB = new ObservableCollection <Party>(parties);

            this.listView.ItemsSource = _partiesFromDB;
        }
Esempio n. 2
0
        private async void OnSave(object sender, EventArgs e)
        {
            List <Party> p = await dbTransaction.GetParties();

            if (isPartyValid())
            {
                if (_party.PartyID != 0)
                {
                    dbTransaction.UpdateAsync(_party);
                    await DisplayAlert("Success", $"{_party.PartyName} updated", "OK");

                    await Navigation.PopAsync();
                }
                else
                {
                    dbTransaction.InsertAsync(_party);
                    await DisplayAlert("Success", $"{_party.PartyName} saved", "OK");
                }

                ClearControls();
            }
        }