コード例 #1
0
        public List <Album> SearchAlbum(string name, SearchEnum type)
        {
            var responseService = _searchService.Search(name, type.ToString());

            var arrItem = ((AlbumSearch)responseService).albums.items;

            List <Album> listAlbum = new List <Album>();

            for (int i = 0; i < arrItem.Length; i++)
            {
                var   tr    = new AlbumBusiness();
                Album album = new Album()
                {
                    name        = arrItem[i].name,
                    id          = arrItem[i].id,
                    type        = arrItem[i].album_type,
                    totalTracks = arrItem[i].total_tracks,
                    albumArtist = arrItem[i].artists[0].name,
                    images      = ImageMapper.ImageMapping(arrItem[i].images)
                };

                listAlbum.Add(album);
            }

            return(listAlbum);
        }
コード例 #2
0
        private List <Album> AlbumArtist(string id)
        {
            var responseService = _artistService.AlbumsArtist(id);
            var arrAlbums       = responseService.items;

            List <Album> listAlbums = new List <Album>();

            for (int i = 0; i < arrAlbums.Length; i++)
            {
                var tr = new AlbumBusiness();
                //Track[] tracksAlbum = tr.Album(arrAlbums[i].id).tracks;
                Album album = new Album()
                {
                    name        = arrAlbums[i].name,
                    albumArtist = arrAlbums[i].artists[0].name,
                    id          = arrAlbums[i].id,
                    images      = ImageMapper.ImageMapping(arrAlbums[i].images),
                    totalTracks = arrAlbums[i].total_tracks,
                    type        = arrAlbums[i].type,
                    //tracks = tracksAlbum
                };
                listAlbums.Add(album);
            }
            return(listAlbums);
        }