Beispiel #1
0
        public ActionResult Recommendations(string trackId, string artistId)
        {
            CustomToken token = ViewBag.Token;

            if (token.IsTokenEmpty())
            {
                return(null);
            }

            var recommendations = _paradifyService.GetRecommendations(token, trackId, artistId);

            if (recommendations != null && recommendations.Tracks != null && recommendations.Tracks.Count > 0)
            {
                SeveralTracks tracks = _paradifyService.GetTracks(recommendations.Tracks.Select(t => t.Id).ToList(), token);

                if (tracks != null && tracks.Tracks != null && tracks.Tracks.Count > 0)
                {
                    return(PartialView("~/Views/Shared/_RecommendedSongListShort.cshtml",
                                       tracks.Tracks));
                }
            }

            return(PartialView("~/Views/Shared/_RecommendedSongListShort.cshtml",
                               null));
        }
Beispiel #2
0
        public ActionResult Recommendations(string trackId, string artistId)
        {
            CustomToken token = ViewBag.Token;

            if (token.IsTokenEmpty())
            {
                return(null);
            }

            var recommendations = _paradifyService.GetRecommendations(token, trackId, artistId);

            if (recommendations != null && recommendations.Error != null && !string.IsNullOrEmpty(recommendations.Error.Message))
            {
                log.Error(string.Format(recommendations.Error.Message + " in Recommendations trackId:{0} artistId:{1}", trackId, artistId));
            }

            if (recommendations != null && recommendations.Tracks != null && recommendations.Tracks.Count > 0)
            {
                return(PartialView("~/Views/Shared/_RecommendedSongListShort.cshtml",
                                   recommendations.Tracks));
            }

            return(null);
        }
Beispiel #3
0
 private Recommendations GetRecommendations(CustomToken token, string trackId, string artistId)
 {
     return(_paradifyService.GetRecommendations(token, trackId, artistId));
 }