public static PlaylistItem Create(PlaylistItemDto playlistItemDto, IPlaylistManager playlistManager) { PlaylistItem playlistItem = new PlaylistItem { Cid = playlistItemDto.Cid, Id = playlistItemDto.Id, Playlist = playlistManager.Get(playlistItemDto.PlaylistId), Sequence = playlistItemDto.Sequence, Title = playlistItemDto.Title, Video = Video.Create(playlistItemDto.Video) }; return(playlistItem); }
public PlaylistItemDto Create(PlaylistItemDto playlistItemDto) { PlaylistItemDto savedPlaylistItemDto; using (ITransaction transaction = Session.BeginTransaction()) { Playlist playlist = PlaylistManager.Get(playlistItemDto.PlaylistId); SongDto songDto = playlistItemDto.Song; PlaylistItem playlistItem = new PlaylistItem(playlistItemDto.Id, playlistItemDto.Title, playlistItemDto.Cid, songDto.Id, songDto.Type, songDto.Title, songDto.Duration, songDto.Author); playlistItemDto.SetPatchableProperties(playlistItem); playlist.AddItem(playlistItem); PlaylistItemManager.Save(playlistItem); savedPlaylistItemDto = PlaylistItemDto.Create(playlistItem); transaction.Commit(); } return(savedPlaylistItemDto); }