public ActionResult AddToPlayList(int trackId, string returnUrl) { if (User.Identity.IsAuthenticated) { MusicRoomContext context = new MusicRoomContext(); PlayListRepository playListRepository = new PlayListRepository(); PlayList playList = new PlayList(); foreach (var data in context.Tracks) { if (data.TrackId == trackId) { playList.TrackPath = data.FileName; playList.Author = data.Author; playList.TrackName = data.TrackName; } } playList.UserId = WebSecurity.CurrentUserId; playListRepository.InsertOrUpdate(playList); playListRepository.Save(); } return Redirect(returnUrl); }
public ActionResult DeleteTrack(int trackId, string returnUrl) { PlayListRepository playListRepository = new PlayListRepository(); playListRepository.Delete(trackId); playListRepository.Save(); return Redirect(returnUrl); }