Esempio n. 1
0
        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> SearchPageZoneElements(long tenantId, long pageId, long masterPageZoneId)
        {
            IEnumerable <PageViewZoneElement> pageViewZoneElements = await _pageViewService.SearchPageViewZoneElementsAsync(tenantId, pageId, masterPageZoneId);

            return(Ok(pageViewZoneElements));
        }