private void SearchTracklists(string searchQuery) { QueryTracklists.Clear(); foreach (var item in AllTracklists) { if (item.TracklistName.ToLower().Contains(searchQuery.ToLower())) { QueryTracklists.Add(item); } } }
private async Task Init() { var albumlists = await _albumListService.Get <List <AlbumList> >(new AlbumListSearchRequest() { UserId = APIService.loggedProfile.UserId }); var tracklists = await _tracklistService.Get <List <Tracklist> >(new TracklistSearchRequest() { UserId = APIService.loggedProfile.UserId }); foreach (var item in albumlists) { var numberofalbums = await _albumListAlbumService.Get <List <AlbumListAlbum> >(new AlbumListAlbumSearchRequest() { AlbumListId = item.AlbumListId }); AlbumListHelperVM local = new AlbumListHelperVM() { AlbumListId = item.AlbumListId, AlbumListName = item.AlbumListName, ListDateCreated = item.ListDateCreated, UserId = APIService.loggedProfile.UserId, Username = APIService.loggedProfile.Username, NumberOfAlbums = "Number of albums: " + numberofalbums.Count.ToString() }; MyAlbumLists.Add(local); QueryAlbumLists.Add(local); } 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 = APIService.loggedProfile.UserId, Username = APIService.loggedProfile.Username }; MyTracklists.Add(local); QueryTracklists.Add(local); } }
private async Task LoadTracklists() { var tracklistsReturned = await _tracklistService.Get <List <Model.Tracklist> >(new TracklistSearchRequest() { TracklistType = "Public" }); var tracklistTracksReturned = await _tracklistTrackService.Get <List <Model.TracklistTrack> >(null); foreach (var item in tracklistsReturned) { TracklistHelperVM local = new TracklistHelperVM() { ListDateCreated = item.ListDateCreated, TracklistName = item.TracklistName, UserId = item.UserId, TracklistId = item.TracklistId }; local.Username = "******" + AllUsers.Where(a => a.UserId == local.UserId).Select(a => a.Username).FirstOrDefault(); local.NumberOfTracks = "Number of tracks: " + tracklistTracksReturned.Where(a => a.TracklistId == local.TracklistId).Count().ToString(); AllTracklists.Add(local); QueryTracklists.Add(local); } }