async void FavouriteOnTapped(object sender, EventArgs args)
        {
            Favourite newFavourite = await App.FavouriteManager.Create(App.mUser.ID, Convert.ToInt32(mId));

            var         newfavouriteID = newFavourite.ID;
            ToastConfig tc             = new ToastConfig(AppResources.MessageFavAdded)
                                         .SetDuration(TimeSpan.FromSeconds(3));

            UserDialogs.Instance.Toast(tc);

            await PopupNavigation.PopAsync();
        }
Exemple #2
0
        private async void OnClicked(object sender, EventArgs e)
        {
            //pls change base on your database data
            int userId         = 2;
            int chatMessageID  = 264;
            int newfavouriteID = 0;

            //create new favaurite
            Favourite newFavourite = await App.FavouriteManager.Create(userId, chatMessageID);

            newfavouriteID = newFavourite.ID;

            //delete favourite
            await App.FavouriteManager.Delete(newfavouriteID);

            //get original count
            int count = 0;
            ObservableCollection <Favourite> favouriteList = await App.FavouriteManager.GetByUser(userId);

            count = favouriteList.Count;

            //create a few new favourite
            Favourite newFavourite1 = await App.FavouriteManager.Create(userId, chatMessageID);

            Favourite newFavourite2 = await App.FavouriteManager.Create(userId, chatMessageID);

            //get favourite list by user
            int newCount = 0;

            favouriteList = await App.FavouriteManager.GetByUser(userId);

            newCount = favouriteList.Count;

            if (count + 2 == newCount)
            {
                Debug.WriteLine(@"				Count Correct!!");
            }
        }