コード例 #1
0
        public IEnumerable <PlaylistItem> Get(string name, IMap <IEnumerable <PlaylistItem>, IEnumerable <MixxxPlaylistTrack> > mapper)
        {
            using (var transaction = _connection.BeginTransaction())
            {
                var mixxPlaylist = MixxxPlaylist.Load(name, true, _connection, transaction);

                if (mixxPlaylist == null || mixxPlaylist.Id == 0)
                {
                    return(null);
                }
                return(mapper.Transform(mixxPlaylist.PlaylistTracks));
            }
        }
コード例 #2
0
 public bool Delete(string name)
 {
     using (var transaction = _connection.BeginTransaction())
     {
         var existingMixxPlaylist = MixxxPlaylist.Load(name, true, _connection, transaction);
         if (existingMixxPlaylist == null || existingMixxPlaylist.Id <= 0)
         {
             transaction.Rollback();
             return(false);
         }
         if (existingMixxPlaylist.Delete(_connection, transaction))
         {
             transaction.Commit();
             return(true);
         }
         transaction.Rollback();
         return(false);
     }
 }