private async Task Init() { var tracklists = await _tracklistService.Get <List <Tracklist> >(new TracklistSearchRequest() { UserId = UserId, TracklistType = "Public" }); var thisUser = await _userService.GetById <UserProfile>(UserId); foreach (var item in tracklists) { var numberoftracks = await _tracklistTrackService.Get <List <TracklistTrack> >(new TracklistTrackSearchRequest() { TracklistId = item.TracklistId }); TracklistHelperVM local = new TracklistHelperVM() { TracklistId = item.TracklistId, ListDateCreated = item.ListDateCreated, NumberOfTracks = "Number of tracks: " + numberoftracks.Count.ToString(), TracklistName = item.TracklistName, UserId = thisUser.UserId, Username = thisUser.Username }; Tracklists.Add(local); } FeaturedTracklists = "Featured Tracklists by: " + thisUser.Username; }
private void Search(string searchQuery) { Tracklists.Clear(); foreach (var item in AllTracklists) { if (item.TracklistName.ToLower().Contains(searchQuery.ToLower())) { Tracklists.Add(item); } } }
private async Task AddNewTracklist() { var popUp = new PopupAddOnTheFlyList(false); popUp.CallbackEvent += async(object sender, object e) => { AllTracklists.Clear(); Tracklists.Clear(); await Init(); }; await PopupNavigation.Instance.PushAsync(popUp); }
private async Task Init() { var returned = await _tracklistService.Get <List <Tracklist> >(new TracklistSearchRequest() { UserId = APIService.loggedProfile.UserId }); returned.Remove(returned.Where(a => a.TracklistName == "Liked Tracks").FirstOrDefault()); returned.Remove(returned.Where(a => a.TracklistName == "My Discovery Queue").FirstOrDefault()); returned.Remove(returned.Where(a => a.TracklistName == "History").FirstOrDefault()); foreach (var item in returned) { var tracks = await _tracklistTrackService.Get <List <TracklistTrack> >(new TracklistTrackSearchRequest() { TracklistId = item.TracklistId }); if (tracks.Where(a => a.TrackId == ThisTrackId).FirstOrDefault() == null) { AllTracklists.Add(item); Tracklists.Add(item); } } }