public PlaylistTrack UpdatePlayListTrack(PlaylistTrack playlistTrack)
        {
            var originalTrack = context.PlaylistTracks.Find(playlistTrack.Id);
            if (originalTrack == null) return null;

            context.Entry(originalTrack).CurrentValues.SetValues(playlistTrack);
            context.Entry(originalTrack).State = EntityState.Modified;
            context.SaveChanges();

            return originalTrack;
        }
        public Track CreateTrack(long playlistId, Track track)
        {
            var playlist = ReadPlaylist(playlistId);
            if (playlist == null) return null;

            var playlistTrack = new PlaylistTrack {Track = track};
            if(playlist.PlaylistTracks == null) playlist.PlaylistTracks = new Collection<PlaylistTrack>();
            
            playlist.PlaylistTracks.Add(playlistTrack);
           
            context.SaveChanges();
            
            return playlistTrack.Track;
        }
예제 #3
0
 public PlaylistTrack UpdatePlayListTrack(PlaylistTrack playlistTrack)
 {
     return repo.UpdatePlayListTrack(playlistTrack);
 }