public void Delete(Guid itemId) { try { PlaylistItem playlistItem = Get(itemId); playlistItem.Playlist.Items.Remove(playlistItem); PlaylistItemDao.Delete(playlistItem); } catch (Exception exception) { Logger.Error(exception); throw; } }
public void Delete(Guid itemId) { try { PlaylistItem playlistItem = PlaylistItemDao.Get(itemId); // Be sure to remove from Playlist first so that cascade doesn't re-save. playlistItem.Playlist.RemoveItem(playlistItem); PlaylistItemDao.Delete(playlistItem); } catch (Exception exception) { Logger.Error(exception); throw; } }
public void Delete(Guid itemId) { try { NHibernateSessionManager.Instance.BeginTransaction(); PlaylistItem playlistItem = PlaylistItemDao.Get(itemId); // Be sure to remove from Playlist first so that cascade doesn't re-save. playlistItem.Playlist.RemoveItem(playlistItem); PlaylistItemDao.Delete(playlistItem); NHibernateSessionManager.Instance.CommitTransaction(); } catch (Exception exception) { Logger.Error(exception); NHibernateSessionManager.Instance.RollbackTransaction(); throw; } }