Exemple #1
0
        public async void AddStoryFavorite(Truyen story)
        {
            // kiem tra xem thu trong favorite database co' no' k0
            var value = await Connection.Table <TruyenSqlFavoriteData>().Where(o => o.Site == story.Site && o.TruyenUrl == story.TruyenUrl).FirstOrDefaultAsync();

            if (value == null)
            {
                var truyenfavorite = TruyenSqlFavoriteData.Convert(story);
                await Connection.InsertAsync(truyenfavorite);
            }
        }
Exemple #2
0
        private async Task <bool> LoadingFavorite()
        {
            if (await _settingService.IsHaveFavorite())
            {
                if (!IsLoading)
                {
                    IsLoading = true;
                    DanhSachTruyen.Clear();
                    TheLoaiDangXem = Wrapper.TagTruyen.Favorite;
                    var list = await _settingService.ListFavoriteSong();

                    foreach (var truyenKey in list)
                    {
                        DanhSachTruyen.Add(TruyenSqlFavoriteData.Convert(truyenKey));
                    }
                    IsLoading = false;
                }
                return(true);
            }

            return(false);
        }