Ejemplo n.º 1
0
        /// <summary>
        /// 返回母版视图
        /// </summary>
        /// <param name="name">视图名称</param>
        /// <param name="flag">是否是首页(默认不是)</param>
        /// <returns></returns>
        private async Task <IActionResult> ViewAsync(string name = null, bool flag = false)
        {
            //获取热门文章
            ViewBag.Recommend = await _blogAppService.GetArticlesRecommendByTypeIdAsync(pageSize : 5);

            //获取类型菜单
            ViewBag.Menu = (await _blogAppService.GetArticleTypeMenusAsync()).Items;
            //获取标签云
            ViewBag.Tags = (await _blogAppService.GetArticleTagCloudAsync()).Items;
            //获取友情链接
            ViewBag.Links = (await _blogAppService.GetFriendshipLinksAsync())
                            .Items
                            .Where(p => p.ToExamine == ToExamine.Adopt)
                            .WhereIf(!flag, p => p.LinkType == LinkType.TotalStation)
                            .ToList();
            //.Where(p => p.OfflineTime == null || p.OfflineTime > DateTime.Now)
            //.ToList();
            //获取审核通知(必须是管理员才行)
            if (await IsGrantedAsync(PermissionNames.Pages_Blogs_Admin))
            {
                ViewBag.AuditNotice = await _blogAppService.GetAuditNotice();
            }
            ViewBag.BlogConfig = blogSite;
            if (name == null)
            {
                return(View());
            }
            return(View(name));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Flike()
        {
            var links = (await _blogAppService.GetFriendshipLinksAsync()).Items;

            return(View(links));
        }