예제 #1
0
        public async Task <IActionResult> Index(int?page)
        {
            var coreSettings = await settingService.GetSettingsAsync <CoreSettings>();

            var nav = coreSettings.Home;

            if (nav.Type == ENavType.Page)
            {
                var page2 = await pageService.GetAsync(nav.Id);

                var(pagePath, pageModel) = await homeHelper.GetPageAsync(page2.Slug);

                await statsService.IncViewCountAsync(EPostType.Page, pageModel.Id);

                pageModel.ViewCount++;
                return(View(pagePath, pageModel));
            }
            else if (nav.Type == ENavType.BlogCategory)
            {
                var cat = await categoryService.GetAsync(nav.Id);

                var(catPath, catModel) = await homeHelper.GetBlogCategoryAsync(cat.Slug, BlogPostService.DEFAULT_PAGE_INDEX);

                return(View(catPath, catModel));
            }

            // default to blog app
            var(indexPath, indexModel) = await homeHelper.GetBlogIndexAsync(page);

            return(View(indexPath, indexModel));
        }
예제 #2
0
        public async Task <IActionResult> Page(string parentPage, string childPage)
        {
            var(_, viewModel) = await homeHelper.GetPageAsync(parentPage, childPage);

            await statsService.IncViewCountAsync(EPostType.Page, viewModel.Id);

            viewModel.ViewCount++;
            Title       = viewModel.Title;
            Description = viewModel.Excerpt;
            return(View(viewModel));
        }