public override async Task<IDisplayResult> EditAsync(ContentItem model, IUpdateModel updater) { // This method can get called when a new content item is created, at that point // the query string contains a ListPart.ContainerId value, or when an // existing content item has ContainedPart value. In both cases the hidden field // needs to be rendered in the edit form to maintain the relationship with the parent. if (model.Is<ContainedPart>()) { return BuildShape(model.As<ContainedPart>().ListContentItemId); } var viewModel = new EditContainedPartViewModel(); if ( await updater.TryUpdateModelAsync(viewModel, "ListPart")) { // We are editing a content item that needs to be added to a container // so we render the container id as part of the form return BuildShape(viewModel.ContainerId); } return null; }
public void RemoveVersion(ContentItem item) { _content.Remove(item); if (item.Is<VersionInfoPart>()) { item.As<VersionInfoPart>().Removed = true; item.As<VersionInfoPart>().Draft = false; } }
public void PublishVersion(ContentItem item) { Publish(item); if (item.Is<VersionInfoPart>()) { item.As<VersionInfoPart>().Removed = false; item.As<VersionInfoPart>().Draft = false; } }