示例#1
0
        // GET: /<controller>/
        public async Task <ActionResult <WebAppModelItem <Page> > > Index(string lang, string pagePath)
        {
            _logger.LogDebug("Requesting '{0}' page", pagePath);

            Site oSite = await _siteService.GetDefaultSiteAsync();

            if (lang.Length != 2)
            {
                return(null);
            }

            // magic
            pagePath = pagePath.ToLower();

            // get page
            Page page = await _pageService.GetBySlug(pagePath, oSite.Id);

            page.MasterPage = await _pageService.GetByIdAync(page.MasterPageId.Value);

            // menu
            var menus = await _menusService.GetBySiteIdAsync(oSite.Id);

            return(View(new WebAppModelItem <Page>
            {
                Item = page,
                Site = oSite,
                Menus = menus.ToDictionary(x => x.Name, x => x)
            }));
        }