Beispiel #1
0
        public async Task <IActionResult> UpdatePageAsync(Guid userId, Guid pageId, [FromBody] GeneralWebPageUpdateRequest updateRequest, CancellationToken cancellationToken)
        {
            if (updateRequest.Blocks != null)
            {
                foreach (var block in updateRequest.Blocks)
                {
                    if (block.Item.ContentType == "textBlock" && block.Content.ContainsKey("blocks"))
                    {
                        block.Content.Remove("blocks");
                    }
                }
            }

            var pageGuid = await _contentService.UpdatePageAsync(userId, pageId, updateRequest, cancellationToken);

            return(new JsonResult(pageGuid));
        }
Beispiel #2
0
        /// <inheritdoc />
        public async Task <ApiResponse <string> > UpdatePageAsync(Guid userId, Guid contentId, GeneralWebPageUpdateRequest updateRequest, CancellationToken cancellationToken)
        {
            if (Guid.Empty == userId)
            {
                throw new ArgumentOutOfRangeException(nameof(userId));
            }
            if (Guid.Empty == contentId)
            {
                throw new ArgumentOutOfRangeException(nameof(contentId));
            }

            return(await _contentCommand.UpdatePageAsync(contentId, updateRequest, cancellationToken));
        }
Beispiel #3
0
 /// <inheritdoc />
 public Task <ApiResponse <string> > UpdatePageAsync(Guid contentId, GeneralWebPageUpdateRequest pageModel, CancellationToken cancellationToken)
 {
     return(_contentApiClientProvider.SendRequestAsync <ApiResponse <string> >(HttpMethod.Put, $"api/page/{contentId}", JsonContent.Create(pageModel)));
 }