public async Task <IActionResult> ReadMasterPageAsync(long masterPageId) { MasterPage masterPage = await _masterPageService.ReadMasterPageAsync(TenantId, masterPageId); if (masterPage == null) { return(NotFound()); } return(Ok(masterPage)); }
/// <summary> /// TODO: This method should be deprecated - it is only needed to support older websites where this page list functionality is required. /// Older websites should be updated, so that this method can be removed. Once removed: /// long pageListPageId = await GetPageListPageId(settings, context); /// Can be replaced with: /// long pageListPageId = settings.PageId ?? context.PageId; /// </summary> /// <param name="settings">Element settings.</param> /// <param name="context">Page context.</param> /// <returns>ID of page whose child pages are enumerated.</returns> private async Task <long> GetPageListPageId(PageListElementSettings settings, IPageContext context) { // If page list page ID is not specified in settings (i.e. is determined by page context) and the page is a document, then return document's parent folder if (settings.PageId == null) { Page pageListPage = await _pageService.ReadPageAsync(settings.TenantId, context.PageId); MasterPage masterPage = await _masterPageService.ReadMasterPageAsync(settings.TenantId, pageListPage.MasterPageId); if (masterPage.PageType == PageType.Document) { return(pageListPage.ParentPageId.Value); } return(pageListPage.PageId); } // Otherwise, return specified page return(settings.PageId.Value); }