public void SetLikedSongs(string trackId, string songName, string imageUrl, string bandName) { var likedSongList = GetLikedSongs(); var selectedSong = new SelectedSongItem() { TrackId = trackId, SongName = songName, ImageUrl = imageUrl, BandName = bandName }; likedSongList.Add(selectedSong); var json = JsonConvert.SerializeObject(likedSongList); _httpContextAccessor.HttpContext.Session.SetString(LikeListSessionKey, json); }
public IActionResult AddLikedSong(SelectedSongItem song) { _likedSongsService.SetLikedSongs(song.TrackId, song.SongName, song.ImageUrl, song.BandName); return(song.PlaylistId == null?RedirectToAction("Index", "Home") : RedirectToAction("Tracks", "Search", new { id = song.PlaylistId })); }