Example #1
0
        public void Update(PlaylistItem playlistItem)
        {
            try
            {
                NHibernateSessionManager.Instance.BeginTransaction();
                playlistItem.ValidateAndThrow();
                playlistItem.Video.ValidateAndThrow();

                PlaylistItem knownPlaylistItem = PlaylistItemDao.Get(playlistItem.Id);

                if (knownPlaylistItem == null)
                {
                    PlaylistItemDao.Update(playlistItem);
                }
                else
                {
                    PlaylistItemDao.Merge(playlistItem);
                }

                NHibernateSessionManager.Instance.CommitTransaction();
            }
            catch (Exception exception)
            {
                Logger.Error(exception);
                NHibernateSessionManager.Instance.RollbackTransaction();
                throw;
            }
        }
        private void DoUpdate(PlaylistItem playlistItem)
        {
            playlistItem.ValidateAndThrow();
            playlistItem.Video.ValidateAndThrow();

            PlaylistItem knownPlaylistItem = PlaylistItemDao.Get(playlistItem.Id);

            if (knownPlaylistItem == null)
            {
                PlaylistItemDao.Update(playlistItem);
            }
            else
            {
                PlaylistItemDao.Merge(playlistItem);
            }
        }