/// <inheritdoc/> public async Task <ContentState> SetContentWorkflowStateAsync( string slug, string contentId, string workflowId, string stateName, CmsIdentity stateChangedBy) { if (slug is null) { throw new ArgumentNullException(nameof(slug)); } if (string.IsNullOrEmpty(contentId)) { throw new ArgumentException("message", nameof(contentId)); } if (string.IsNullOrEmpty(workflowId)) { throw new ArgumentException("message", nameof(workflowId)); } if (string.IsNullOrEmpty(stateName)) { throw new ArgumentException("message", nameof(stateName)); } ItemResponse <ContentState> response = await this.container.CreateItemAsync( new ContentState { Slug = slug, ContentId = contentId, StateName = stateName, WorkflowId = workflowId, ChangedBy = stateChangedBy }, new PartitionKey(PartitionKeyHelper.GetPartitionKeyFromSlug(slug))).ConfigureAwait(false); return(response.Resource); }
/// <inheritdoc/> public async Task <ContentSummary> GetContentSummaryAsync(string contentId, string slug) { try { ItemResponse <ContentSummary> response = await this.container.ReadItemAsync <ContentSummary>( contentId, new PartitionKey(PartitionKeyHelper.GetPartitionKeyFromSlug(slug))).ConfigureAwait(false); return(response.Resource); } catch (CosmosException ex) when(ex.StatusCode == HttpStatusCode.NotFound) { throw new ContentNotFoundException("Content not found.", ex); } }