/// <summary> /// Simple but less efficient way of getting a page url if you only know /// the id. Use the overload accepting an IPageRoute if possible to save a /// potential db query if the route isn't cached. /// </summary> public async Task <string> PageAsync(int?pageId) { if (!pageId.HasValue) { return(string.Empty); } var query = new GetPageRouteByIdQuery(pageId.Value); var route = await _queryExecutor.ExecuteAsync(query); return(Page(route)); }
public async Task <PageDetails> ExecuteAsync(GetPageDetailsByIdQuery query, IExecutionContext executionContext) { var dbPageVersion = await GetPageById(query.PageId).FirstOrDefaultAsync(); if (dbPageVersion == null) { return(null); } var pageRouteQuery = new GetPageRouteByIdQuery(query.PageId); var pageRoute = await _queryExecutor.ExecuteAsync(pageRouteQuery, executionContext); EntityNotFoundException.ThrowIfNull(pageRoute, query.PageId); var regions = await _queryExecutor.ExecuteAsync(GetRegionsQuery(dbPageVersion), executionContext); return(Map(dbPageVersion, regions, pageRoute)); }
public async Task <PageRenderSummary> ExecuteAsync(GetPageRenderSummaryByIdQuery query, IExecutionContext executionContext) { var pageRouteQuery = new GetPageRouteByIdQuery(query.PageId); var pageRoute = await _queryExecutor.ExecuteAsync(pageRouteQuery, executionContext); if (pageRoute == null) { return(null); } var dbPage = await QueryPageAsync(query, executionContext); if (dbPage == null) { return(null); } var page = _pageRenderSummaryMapper.Map <PageRenderSummary>(dbPage, pageRoute); return(page); }
public async Task <PageRenderDetails> ExecuteAsync(GetPageRenderDetailsByIdQuery query, IExecutionContext executionContext) { var dbPage = await QueryPageAsync(query, executionContext); if (dbPage == null) { return(null); } var pageRouteQuery = new GetPageRouteByIdQuery(dbPage.PageId); var pageRoute = await _queryExecutor.ExecuteAsync(pageRouteQuery, executionContext); var page = _pageRenderDetailsMapper.Map(dbPage, pageRoute); var dbPageBlocks = await QueryPageBlocks(page).ToListAsync(); var allBlockTypes = await _queryExecutor.ExecuteAsync(new GetAllPageBlockTypeSummariesQuery(), executionContext); await _entityVersionPageBlockMapper.MapRegionsAsync(dbPageBlocks, page.Regions, allBlockTypes, query.PublishStatus, executionContext); return(page); }
public IDomainRepositoryQueryContext <PageRoute> AsRoute() { var query = new GetPageRouteByIdQuery(_pageId); return(DomainRepositoryQueryContextFactory.Create(query, ExtendableContentRepository)); }