public async Task <IActionResult> CommitEditAsync([FromQuery] Guid editId) { var editSession = await pageContentService.FindEditByIdAsync(editId); if (editSession == null) { return(BadRequest()); } var page = await pageService.FindPageByIdAsync(editSession.PageId); if (page == null) { return(BadRequest()); } await pageContentService.CommitEditAsync(editSession); return(Ok(await pageLinkGenerator.GetPathAsync(page))); }
public async Task CommitEdit() { var page = await pageService.FindPageByPathAsync("test"); var edit = await pageContentService.BeginEditAsync(page); var newContent = new TestPageContent() { Title = "test2" }; await pageContentService.SetContentAsync(edit, newContent); await pageContentService.CommitEditAsync(edit); Assert.Null(await pageContentService.FindEditByIdAsync(edit.Id)); var contentData = (TestPageContent)await pageService.GetPageContentAsync(page); Assert.NotNull(contentData); Assert.Equal("test2", contentData.Title); }