Ejemplo n.º 1
0
        public async Task <List <MiniTrack> > GetRecommendationsAsync(RecommendFormViewModel form)
        {
            List <MiniTrack> tracks = new List <MiniTrack>();

            form.Artists = form.Artists ?? new List <string>();
            form.Tracks  = form.Tracks ?? new List <string>();

            var result = await GetSpotifyDataAsync(
                $"{_url}/?seed_artists={string.Join(",",form.Artists)}&seed_tracks={string.Join(",",form.Tracks)}");

            if (result == null)
            {
                return(null);
            }
            tracks = result["tracks"]
                     .Select(x => x.ToObject <MiniTrack>()).ToList();

            return(tracks);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Recommend(RecommendFormViewModel form)
        {
            var recommaendations = await _recommendation.GetRecommendationsAsync(form);

            return(View(recommaendations));
        }