public IActionResult Playlist(string playlistId) { string userId = HttpContext.Session.Get <string>("userId"); SpotifyService service = new SpotifyService(); Track selectedTrack = HttpContext.Session.Get <Track>("track"); string query = selectedTrack.TrackName + " " + selectedTrack.ArtistName; string trackId = service.GetTracks(query, 1, ApiManager.GetKey(Constants.Services.Spotify))[0].ID; bool success = service.AddTrackToPlaylist(userId, playlistId, trackId, ApiManager.GetKey(Constants.Services.Spotify)); if (success) { TempData["addedTrack"] = true; } return(RedirectToAction("Index", new { id = selectedTrack.ID })); }