private async Task Init()
        {
            var tracksintracklist = await _tracklistTrackService.Get <List <TracklistTrack> >(new TracklistTrackSearchRequest()
            {
                TracklistId = TracklistId
            });

            if (AddTracks == false)
            {
                foreach (var item in tracksintracklist)
                {
                    var thisTrack = await _trackService.GetById <Track>(item.TrackId);

                    var thisAlbum = await _albumService.GetById <Album>(thisTrack.AlbumId);

                    var thisArtist = await _artistService.GetById <Artist>(thisAlbum.ArtistId);

                    TrackHelperVM local = new TrackHelperVM()
                    {
                        TrackId    = thisTrack.TrackId,
                        TrackName  = thisTrack.TrackName,
                        AlbumId    = thisAlbum.AlbumId,
                        AlbumName  = thisAlbum.AlbumName,
                        ArtistId   = thisArtist.ArtistId,
                        ArtistName = thisArtist.ArtistName
                    };
                    Tracks.Add(local);
                    AllTracks.Add(local);
                }
            }
        }
Ejemplo n.º 2
0
        private async Task LoadArtistRelatedTracks()
        {
            var returned = await _albumService.Get <List <Album> >(new AlbumSearchRequest()
            {
                ArtistId = ThisArtistId
            });

            var thisArtist = await _artistService.GetById <Artist>(ThisArtistId);

            foreach (var item in returned)
            {
                var tracksInAlbum = await _trackService.Get <List <Track> >(new TrackSearchRequest()
                {
                    AlbumId = item.AlbumId
                });

                foreach (var x in tracksInAlbum)
                {
                    TrackHelperVM local = new TrackHelperVM()
                    {
                        AlbumId    = item.AlbumId,
                        AlbumName  = item.AlbumName,
                        ArtistId   = (int)ThisArtistId,
                        ArtistName = thisArtist.ArtistName,
                        TrackId    = x.TrackId,
                        TrackName  = x.TrackName
                    };
                    Tracks.Add(local);
                    AllTracks.Add(local);
                }
            }
        }
        private async Task <int> LoadSumTrackViewsForArtist(int artistId)
        {
            var allAlbums = await _albumService.Get <List <Album> >(new AlbumSearchRequest()
            {
                ArtistId = artistId
            });

            int sum        = 0;
            var thisArtist = await _artistService.GetById <Artist>(artistId);

            foreach (var item in allAlbums)
            {
                var thisAlbumTracks = await _trackService.Get <List <Track> >(new TrackSearchRequest()
                {
                    AlbumId = item.AlbumId
                });

                sum += thisAlbumTracks.Sum(a => (int)a.TrackViews);
                foreach (var x in thisAlbumTracks)
                {
                    TrackHelperVM local = new TrackHelperVM()
                    {
                        AlbumId    = item.AlbumId,
                        AlbumName  = item.AlbumName,
                        ArtistId   = thisArtist.ArtistId,
                        ArtistName = thisArtist.ArtistName,
                        TrackId    = x.TrackId,
                        TrackName  = x.TrackName,
                        TrackViews = (int)x.TrackViews
                    };
                    AllTracks.Add(local);
                }
            }
            return(sum);
        }
Ejemplo n.º 4
0
        private async Task LoadGenreRelatedTracks()
        {
            List <Artist> artistList     = new List <Artist>();
            var           allArtistGenre = await _artistGenreService.Get <List <ArtistGenre> >(new ArtistGenreSearchRequest()
            {
                GenreId = (int)ThisGenreId
            });

            foreach (var item in allArtistGenre)
            {
                var thisArtist = await _artistService.GetById <Artist>(item.ArtistId);

                artistList.Add(thisArtist);
            }
            foreach (var item in artistList)
            {
                var albumList = await _albumService.Get <List <Album> >(new AlbumSearchRequest()
                {
                    ArtistId = item.ArtistId
                });

                foreach (var x in albumList)
                {
                    var trackList = await _trackService.Get <List <Track> >(new TrackSearchRequest()
                    {
                        AlbumId = x.AlbumId
                    });

                    foreach (var y in trackList)
                    {
                        TrackHelperVM local = new TrackHelperVM()
                        {
                            AlbumId    = x.AlbumId,
                            AlbumName  = x.AlbumName,
                            ArtistId   = item.ArtistId,
                            ArtistName = item.ArtistName,
                            TrackId    = y.TrackId,
                            TrackName  = y.TrackName
                        };
                        AllTracks.Add(local);
                        Tracks.Add(local);
                    }
                }
            }
        }
        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);
            }
        }
Ejemplo n.º 6
0
 public void RemoveTrackFromStation(Track track)
 {
     SelectedTracks.Remove(track);
     AllTracks.Add(track);
 }