public async Task ExecuteAsync(Controller controller, PageActionRoutingState state) { var query = new GetPageRenderDetailsByIdQuery(); query.PageId = state.PageRoutingInfo.PageRoute.PageId; // If we're editing a custom entity, then get the latest version if (!state.InputParameters.IsEditingCustomEntity) { query.WorkFlowStatus = state.VisualEditorMode.ToWorkFlowStatusQuery(); query.PageVersionId = state.InputParameters.VersionId; } state.PageData = await _queryExecutor.ExecuteAsync(query); // if no data is found there was an issue with creating a draft earlier on. if (state.PageData == null && state.VisualEditorMode == VisualEditorMode.Edit) { throw new ApplicationException("Draft version missing for page id " + query.PageId); } // If we can't find any page data, then return a 404 if (state.PageData == null) { state.Result = _notFoundViewHelper.GetView(); } }
public async Task ExecuteAsync(Controller controller, PageActionRoutingState state) { // Find a 404 page if a version exists. if (state.PageRoutingInfo == null) { // First check for a rewrite rule and apply it state.Result = await GetRewriteResult(controller); if (state.Result != null) { return; } // else try and find a 404 page route state.PageRoutingInfo = await TryFindNotFoundPageRoute(state.InputParameters.Path, state.VisualEditorMode); // If we still can't find a 404, fall back to the generic 404 view if (state.PageRoutingInfo == null) { state.Result = _notFoundViewHelper.GetView(); } } }