예제 #1
0
        private static List <Genero> BuildListGenero()
        {
            var list = Genero.ListEmpty();

            foreach (var item in Enumerators.GetEnumDescriptions(typeof(GeneroEnum)))
            {
                var newObj = Genero.Build(item.Key, item.Value);
                list.Add(newObj);
            }

            return(list);
        }
        private async Task <List <Disco> > GetDiscsByGenre(string token, EnumKeyValue generoEnum)
        {
            var urlTrack = SpotifyWebBuilder.BuildUrlTrack(_spotifySettings.SearchUrl, generoEnum.Description, _spotifySettings.MaximumLimitByGenre, 1);
            var response = await GetTracks(urlTrack, token);

            var listDisco = Disco.ListEmpty();

            foreach (var item in response?.tracks?.items)
            {
                var artista = Artista.Build(item.artists.FirstOrDefault().name);
                var genero  = Genero.Build(generoEnum.Key, generoEnum.Description);

                var disco = Disco.Build(genero.GeneroId, item.name, artista, genero);
                listDisco.Add(disco);
            }

            return(listDisco);
        }