Beispiel #1
0
        public ActionResult Index(int?pageindex, int id = -1)
        {
            Paging <Blog> page = new Paging <Blog>();

            page.PageIndex = pageindex == null ? 1 : pageindex.Value;
            page.PageSize  = 5;
            page.Items     = blogManager.Getlist(page, id).ToList();

            #region 构造分页
            //构造标签
            int    PageCount = page.TotalNumber;
            int    PageSize  = page.PageSize;
            int    totalPage = (PageCount + PageSize - 1) / PageSize;
            string urlhead   = "/Member/Home/Index/" + id + "?pageindex=";
            string pages     = "<li><a href='" + urlhead + "1" + "'>首页</a></li>";;
            if (page.PageIndex == 1)
            {
                pages += "<li class='disabled'><a href='#'>上一页</a></li>";
            }
            else
            {
                pages += "<li ><a href='" + urlhead + (page.PageIndex - 1) + "'>上一页</a></li>";
            }
            if (page.PageIndex == totalPage)
            {
                pages += "<li class='disabled'><a href='#'>下一页</a></li>";
            }
            else
            {
                pages += "<li ><a href='" + urlhead + (page.PageIndex + 1) + "'>下一页</a></li>";
            }
            pages            += "<li ><a href='" + urlhead + totalPage + "'>最后一页</a></li>";
            ViewBag.Page      = pages;
            ViewBag.PageIndex = page.PageIndex;
            ViewBag.PageCount = totalPage;
            #endregion

            #region 网站设置
            //CustomCon custom = (CustomCon)ConfigurationManager.GetSection("customCon");
            //WebInfo webInfo = custom.WebInfo;
            ViewBag.WebInfo = webInfo;
            #endregion

            #region 置顶博客

            var TopBlog = blogManager.Find(webConfigManager.GetConfig().TopBlog);
            ViewBag.TopBlog = TopBlog;

            #endregion

            return(View(page.Items));
        }
Beispiel #2
0
        //
        // GET: /Control/WebConfig/
        public ActionResult Index()
        {
            BlogConfig blogConfig = webConfigManager.GetConfig();

            return(View(blogConfig));
        }