public ObservableCollection <ShowDto> GetShowCollectionFromSettings() { var serializedShows = CrossSettings.Current.GetValueOrDefault(Constants.SettingsFavouritiesCollectionName, string.Empty); _logger.Log($"Get: {serializedShows}"); var collection = _jsonSerializeService.TryDeserializeObject <ObservableCollection <ShowDto> >(serializedShows); _logger.Log($"Can deserialize: {collection.success}"); return(collection.success ? collection.obj : new ObservableCollection <ShowDto>()); }
public async Task <IEnumerable <EpisodeDto> > GetEpisodes(int showId, bool includeSpecials = true) { var json = await _episodeService.GetEpisodes(showId, includeSpecials); var episodes = _jsonSerializeService.TryDeserializeObject <IEnumerable <EpisodeDto> >(json); if (episodes.success) { return(episodes.obj); } throw new InvalidEpisodeException($"Show id: {showId}; Include specials: {includeSpecials}"); }