Esempio n. 1
0
        private async void AddButton_Clicked(object sender, EventArgs e)
        {
            var index = new Trip();

            index.TripID = tripId;
            var itm = new ShoppingBagModel();

            itm.ItemName = itemName.Text;
            itm.Quantity = quantity.Text;
            ListView_ShoppingBag.BindingContext = itm;
            if (itm.ItemName != "" & itm.ItemName != null)
            {
                itm.TripID = tripId;
                await App._Database.SaveBagItemsAsync(itm);

                if (!App._Items.Contains(itm))
                {
                    App._Items.Add(itm);
                }
                await Navigation.PushAsync(new ShoppingBag(index));
            }
            else
            {
                await Navigation.PushAsync(new ShoppingBag(index));
            }
        }
 public Task <int> SaveBagItemsAsync(ShoppingBagModel item)
 {
     if (item.BagID != 0)
     {
         //return database.InsertAsync(item);
         return(database.UpdateAsync(item));
     }
     else
     {
         return(database.InsertAsync(item));
     }
 }
 public Task <int> DeleteBagItemsAsync(ShoppingBagModel item)
 {
     return(database.DeleteAsync(item));
 }