public async Task <List <Album> > GetArtistTopAlbums(string artistId) { var deezerClient = new HttpClient(); string json = await deezerClient.GetStringAsync(string.Format("http://api.deezer.com/artist/{0}/albums", artistId)); var deezerAlbums = JsonConvert.DeserializeObject <Albums>(json); if (deezerAlbums == null) { return(null); } if (deezerAlbums.Data == null) { return(null); } var albumList = new List <Album>(); foreach (var deezerAlbum in deezerAlbums.Data) { var album = new Album(); album.MapFrom(deezerAlbum); albumList.Add(album); } return(albumList); }
public async Task<List<Album>> GetArtistTopAlbums(string artistId) { var deezerClient = new HttpClient(); string json = await deezerClient.GetStringAsync(string.Format("http://api.deezer.com/artist/{0}/albums", artistId)); var deezerAlbums = JsonConvert.DeserializeObject<Albums>(json); if (deezerAlbums == null) return null; if (deezerAlbums.Data == null) return null; var albumList = new List<Album>(); foreach (var deezerAlbum in deezerAlbums.Data) { var album = new Album(); album.MapFrom(deezerAlbum); albumList.Add(album); } return albumList; }