Пример #1
0
        public void Update(Playlist playlist)
        {
            try
            {
                NHibernateSessionManager.Instance.BeginTransaction();
                playlist.ValidateAndThrow();

                Playlist knownPlaylist = PlaylistDao.Get(playlist.Id);

                if (knownPlaylist == null)
                {
                    PlaylistDao.Update(playlist);
                }
                else
                {
                    PlaylistDao.Merge(playlist);
                }

                NHibernateSessionManager.Instance.CommitTransaction();
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                NHibernateSessionManager.Instance.RollbackTransaction();
                throw;
            }
        }
Пример #2
0
 public void UpdateTitle(Guid playlistId, string title)
 {
     try
     {
         Playlist playlist = PlaylistDao.Get(playlistId);
         playlist.Title = title;
         PlaylistDao.Update(playlist);
     }
     catch (Exception exception)
     {
         Logger.Error(exception);
         throw;
     }
 }
Пример #3
0
 public void UpdateFirstItem(Guid playlistId, Guid firstItemId)
 {
     try
     {
         NHibernateSessionManager.Instance.BeginTransaction();
         Playlist playlist = PlaylistDao.Get(playlistId);
         playlist.FirstItem = PlaylistItemDao.Get(firstItemId);
         PlaylistDao.Update(playlist);
         NHibernateSessionManager.Instance.CommitTransaction();
     }
     catch (Exception exception)
     {
         Logger.Error(exception);
         NHibernateSessionManager.Instance.RollbackTransaction();
         throw;
     }
 }
Пример #4
0
 public void UpdateTitle(Guid playlistId, string title)
 {
     try
     {
         NHibernateSessionManager.Instance.BeginTransaction();
         Playlist playlist = PlaylistDao.Get(playlistId);
         playlist.Title = title;
         PlaylistDao.Update(playlist);
         NHibernateSessionManager.Instance.CommitTransaction();
     }
     catch (Exception exception)
     {
         Logger.Error(exception);
         NHibernateSessionManager.Instance.RollbackTransaction();
         throw;
     }
 }
Пример #5
0
        public void Update(Playlist playlist)
        {
            try
            {
                playlist.ValidateAndThrow();

                Playlist knownPlaylist = PlaylistDao.Get(playlist.Id);

                if (knownPlaylist == null)
                {
                    PlaylistDao.Update(playlist);
                }
                else
                {
                    PlaylistDao.Merge(playlist);
                }
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                throw;
            }
        }
Пример #6
0
        public void Update(Playlist playlist)
        {
            try
            {
                playlist.ValidateAndThrow();

                //  TODO: Is this necessary still? Seems odd to me.
                Playlist knownPlaylist = PlaylistDao.Get(playlist.Id);

                if (knownPlaylist == null)
                {
                    PlaylistDao.Update(playlist);
                }
                else
                {
                    PlaylistDao.Merge(playlist);
                }
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                throw;
            }
        }