コード例 #1
0
        // GET: Redirect
        public ActionResult Redirect(string artist, string track)
        {
            if ((artist == null) || (track == null))
            {
                return(NotFound("Insert artist and track for redirection work."));
            }
            try
            {
                var infoTrack = SearchMusicController.MGetInfoTrack(artist, track);
                var album     = infoTrack.Album;
                if (infoTrack.Album != null)
                {
                    return(RedirectToAction("Music", "Play", new { artist = artist, album = album, track = track }));

                    //return Redirect($"/Play/Music/{artist}/{album}/{track}");
                }
            }
            catch (NullReferenceException)
            {
                return(NotFound("This track is not contained on database."));
            }

            return(NotFound("This track is not contained on some album."));
        }