private async Task <ContentType> ReadContentType(string contentTypeId) { using (_profiler.Measure(nameof(GetContentType))) { return(await _factory.GetContentManagementClient().GetContentType(contentTypeId)); } }
public async Task <Unit> Handle(PublishContentCommand request, CancellationToken cancellationToken) { var contentManagementClient = _factory.GetContentManagementClient(); var entry = await contentManagementClient.GetEntry(request.ContentPublishRequest.ItemId); await contentManagementClient.PublishEntry(entry.SystemProperties.Id, entry.SystemProperties.Version.Value); return(Unit.Value); }
public async Task <Unit> Handle(UpdateItemCommand request, CancellationToken cancellationToken) { var contentManagementClient = _factory.GetContentManagementClient(); var entry = await _query.GetContentItem(request.ContentItem.GetReference(), PublishingTarget.Preview); var contentType = _query.GetContentType(request.ContentItem.Info.TemplateId); var newEntry = _converter.TransformContentItem(entry, request.ContentItem, contentType); await contentManagementClient.UpdateEntryForLocale(newEntry, request.ContentItem.Info.Id, request.ContentItem.Info.Language); return(Unit.Value); }
public async Task <ContentItemReference> Handle(CreateContentCommand request, CancellationToken cancellationToken) { var contentManagementClient = _factory.GetContentManagementClient(); var emptyEntry = await contentManagementClient.CreateEntry(new Entry <dynamic>(), request.CreationRequest.TemplateId); var itemReference = GetItemReference(emptyEntry, request); var entry = await _query.GetContentItem(itemReference, PublishingTarget.Preview); var contentType = _query.GetContentType(request.CreationRequest.TemplateId); var newEntry = _converter.TransformContentItemData(entry, request.CreationRequest.Fields, contentType); await contentManagementClient.UpdateEntryForLocale(newEntry, emptyEntry.SystemProperties.Id, request.CreationRequest.Language); return(itemReference); }