public async Task <IEnumerable <AllJoinedTable> > ExtraSearch(ExtraSearchType extraSearchType) { HttpResponseMessage response = null; switch (extraSearchType) { case ExtraSearchType.None: return(null); case ExtraSearchType.MostPlayed: response = await GetResponse(@"api/songs/mostplayed"); break; case ExtraSearchType.RecentlyAdded: response = await GetResponse(@"api/songs/recentadded"); break; case ExtraSearchType.RecentlyPlayed: response = await GetResponse(@"api/songs/playedrecent"); break; } if (response.StatusCode == System.Net.HttpStatusCode.OK) { var result = await response.Content.ReadAsStringAsync(); return(Newtonsoft.Json.JsonConvert.DeserializeObject <IEnumerable <AllJoinedTable> >(result)); } return(null); }
/// <summary> /// Adds the extra search type to the search history list. /// </summary> /// <param name="extraSearchType">Type of the extra search.</param> private void AddToSearchHistory(ExtraSearchType extraSearchType) { var resultCnt = _songDataProvider.SearchedSongs?.Count; var history = new SearchHistory(); history.ResultCount = resultCnt; RecentSearch.ResultCount = (int)resultCnt; RecentSearch.SearchTerm = extraSearchType.ToString(); }
public async Task ExtraSearch(ExtraSearchType extraSearchType) { ResetResults(); IEnumerable <AllJoinedTable> songs = null; songs = await _horsifySongApi.ExtraSearch(extraSearchType); if (songs?.Count() > 0) { SearchedSongs.AddRange(songs); } }