Example #1
0
 async void RemoveFavourite(Favourite item)
 {
     if (item != null && item.ID != 0)
     {
         FavouritesVar.Remove(item);
         await App.Database.DeleteItemAsync(item);
     }
 }
Example #2
0
        //MAIN VIEW
        async void AddFavourite()
        {
            if (Item.Cityname != null && Item.Cityname != "")
            {
                Search();
                if (Item.ID != 0)
                {
                    int p = FavouritesVar.IndexOf(Item);
                    FavouritesVar.Remove(Item);
                    FavouritesVar.Insert(p, Item);
                }
                else
                {
                    FavouritesVar.Add(Item);
                }
                await App.Database.SaveItemAsync(Item);

                Item = new Favourite();
            }
        }