private async Task LoadTracks() { var tracksReturned = await _trackService.Get <List <Model.Track> >(null); foreach (var item in tracksReturned) { TrackHelperVM local = new TrackHelperVM() { TrackId = item.TrackId, TrackName = item.TrackName, AlbumName = AllAlbums.Where(a => a.AlbumId == item.AlbumId).Select(a => a.AlbumName).FirstOrDefault(), AlbumId = item.AlbumId }; local.ArtistId = AllAlbums.Where(a => a.AlbumId == local.AlbumId).Select(a => a.ArtistId).FirstOrDefault(); local.ArtistName = AllArtists.Where(a => a.ArtistId == local.ArtistId).Select(a => a.ArtistName).FirstOrDefault(); AllTracks.Add(local); QueryTracks.Add(local); } }
private async Task LoadAlbums() { var allAlbums = await _albumService.Get <List <Model.Album> >(null); foreach (var item in allAlbums) { AlbumHelperVM local = new AlbumHelperVM() { AlbumGeneratedRating = "Rating: " + item.AlbumGeneratedRating.ToString() + "/5", AlbumId = item.AlbumId, AlbumName = item.AlbumName, AlbumPhoto = item.AlbumPhoto, ArtistId = item.ArtistId, DateReleased = "Released: " + item.DateReleased }; local.ArtistName = AllArtists.Where(a => a.ArtistId == local.ArtistId).Select(a => a.ArtistName).FirstOrDefault(); AllAlbums.Add(local); QueryAlbums.Add(local); } }