Exemple #1
0
        public void RemoveFavorite(string volId)
        {
            var volume = FavoriteList.FirstOrDefault(vol => vol.VolumeId == volId);

            if (volume != null)
            {
                FavoriteList.Remove(volume);
            }
        }
        public async Task <bool> RemoveUserFavriteAsync(string favId)
        {
            var vol = FavoriteList.FirstOrDefault(fav => fav.FavId == favId);

            if (String.IsNullOrEmpty(favId) || vol == null)
            {
                return(false);
            }
            try
            {
                await LightKindomHtmlClient.DeleteUserFavorite(favId);

                FavoriteList.Remove(vol);
                CachedClient.UpdateCachedUserFavoriteVolumes(FavoriteList);
                return(true);
            }
            catch (Exception exception)
            {
                Debug.WriteLine("Error : Failed to Remove User Favorite : " + exception.Message);
            }
            return(false);
        }
        public async Task <bool> RemoveUserFavriteAsync(string[] favIds)
        {
            try
            {
                await LightKindomHtmlClient.DeleteUserFavorite(favIds);

                foreach (var favId in favIds)
                {
                    var f = FavoriteList.FirstOrDefault(fa => fa.FavId == favId);
                    if (f != null)
                    {
                        FavoriteList.Remove(f);
                    }
                }
                CachedClient.UpdateCachedUserFavoriteVolumes(FavoriteList);
                return(true);
            }
            catch (Exception exception)
            {
                Debug.WriteLine("Error : Failed to Remove User Favorite : " + exception.Message);
            }
            return(false);
        }