public ActionResult Update(PlaylistItemDto playlistItemDto)
        {
            PlaylistItemDto updatedPlaylistItemDto;

            using (ITransaction transaction = Session.BeginTransaction())
            {
                PlaylistItem playlistItem = PlaylistItem.Create(playlistItemDto, PlaylistManager);
                PlaylistItemManager.Update(playlistItem);

                updatedPlaylistItemDto = PlaylistItemDto.Create(playlistItem);
                transaction.Commit();
            }

            return(Json(updatedPlaylistItemDto));
        }
Пример #2
0
        public void Patch(Guid id, PlaylistItemDto playlistItemDto)
        {
            using (ITransaction transaction = Session.BeginTransaction())
            {
                PlaylistItem playlistItem = PlaylistItemManager.Get(id);
                playlistItemDto.SetPatchableProperties(playlistItem);
                PlaylistItemManager.Update(playlistItem);

                transaction.Commit();
            }
        }
Пример #3
0
        public void UpdateItemTitle_ItemExistsInDatabase_ItemTitleUpdated()
        {
            //  Create and save a playlistItem to the database.
            PlaylistItem playlistItem = Helpers.CreateItemInPlaylist(Playlist);

            //  Change the item's title.
            const string updatedItemTitle = "Updated PlaylistItem title";

            playlistItem.Title = updatedItemTitle;

            PlaylistItemManager.Update(playlistItem);

            //  Check the title of the item from the database -- make sure it updated.
            PlaylistItem itemFromDatabase = PlaylistItemManager.Get(playlistItem.Id);

            Assert.AreEqual(itemFromDatabase.Title, updatedItemTitle);
        }