示例#1
0
        /// <summary>
        /// Blog category.
        /// </summary>
        /// <param name="slug"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public async Task <IActionResult> Category(string slug, int?page)
        {
            var(viewPath, viewModel) = await homeHelper.GetBlogCategoryAsync(slug, page);

            Title = viewModel.CategoryTitle;
            return(View(viewPath, viewModel));
        }
示例#2
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));
        }