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 static List<TrackData> GetAll()
 {
     MusicRoomContext context = new MusicRoomContext();
     Database.SetInitializer<MusicRoomContext>(null);
     List<TrackData> trackDataList = new List<TrackData>();
     StringBuilder tags = new StringBuilder();
     foreach (var data in context.Tracks)
     {
         tags.Clear();
         foreach (var tag in context.TagsInTracks)
         {
             if (tag.TrackId == data.TrackId)
             {
                 tags.Append(tag.Tag.TagName + ",");
             }
         }
         if (tags.Length > 0)
         {
             tags.Remove(tags.Length - 1, 1);
         }
         trackDataList.Add(new TrackData { Id = data.TrackId, Author = data.Author, TrackName = data.TrackName, Tags = tags.ToString(), TrackPath = data.FileName, Like = data.Like});
     }
     return trackDataList;
 }
 public ActionResult Index()
 {
     MusicRoomContext context = new MusicRoomContext();
     return PartialView(context);
 }