private async Task <IActionResult> ReadPageTaggedAsync(long tenantId, long pageId, string tags) { IPageContext context = await GetPageContextAsync(tenantId, pageId, tags); PageView pageView = await _pageViewService.ReadPageViewAsync(tenantId, pageId); Dictionary <long, ElementPartialView> elements = new Dictionary <long, ElementPartialView>(); foreach (PageViewZone pageViewZone in pageView.PageViewZones) { foreach (PageViewZoneElement pageViewZoneElement in pageViewZone.PageViewZoneElements) { if (!elements.ContainsKey(pageViewZoneElement.ElementId)) { elements.Add(pageViewZoneElement.ElementId, await GetElementPartialViewAsync(tenantId, pageViewZoneElement.ElementTypeId, pageViewZoneElement.ElementId, context)); } } } PageViewModel viewModel = new PageViewModel { View = pageView, Elements = elements }; return(View("Read", viewModel)); }
public async Task <IActionResult> Read(long pageId) { long tenantId = TenantId; PageView pageView = await _pageViewService.ReadPageViewAsync(tenantId, pageId); pageView.PageViewZones = await _pageViewService.SearchPageViewZonesAsync(tenantId, pageId); foreach (PageViewZone pageViewZone in pageView.PageViewZones) { pageViewZone.PageViewZoneElements = await _pageViewService.SearchPageViewZoneElementsAsync(tenantId, pageId, pageViewZone.MasterPageZoneId); } Dictionary <long, ElementRender> elements = new Dictionary <long, ElementRender>(); foreach (PageViewZone pageViewZone in pageView.PageViewZones) { foreach (PageViewZoneElement pageViewZoneElement in pageViewZone.PageViewZoneElements) { if (!elements.ContainsKey(pageViewZoneElement.ElementId)) { elements.Add(pageViewZoneElement.ElementId, await GetElementRender(tenantId, pageViewZoneElement.ElementTypeId, pageViewZoneElement.ElementId, pageId)); } } } PageRender pageRender = new PageRender { View = pageView, Elements = elements }; return(View("Read", pageRender)); }
public async Task <IActionResult> ReadPageViewAsync(long pageId) { PageView pageView = await _pageViewService.ReadPageViewAsync(TenantId, pageId); if (pageView == null) { return(NotFound()); } return(Ok(pageView)); }