Exemplo n.º 1
0
        //
        // GET: /PartialView/

        public ActionResult BlogHeader()
        {
            List <BlogCategory> cList = _categoryService.GetCateList();

            ViewData["cList"] = cList;

            return(View());
        }
Exemplo n.º 2
0
        public ActionResult New()
        {
            List <BlogCategory> cList = _categoryService.GetCateList();

            cList.Insert(0, new BlogCategory {
                CateID = 0, CateName = "顶级分类", State = 1, ParentID = 0
            });
            SelectList CateList = new SelectList(cList, "CateID", "CateName");

            BlogCategory model = new BlogCategory();

            model.CreateTime = DateTime.Now;

            ViewData["model"]  = model;
            ViewData["CateID"] = CateList;
            ViewData["hID"]    = 0;

            return(View("Edit"));
        }
Exemplo n.º 3
0
        public ActionResult ArticleList(int?pageIndex, int?pageSize)
        {
            pageIndex = pageIndex ?? 1;
            pageSize  = pageSize ?? 10;

            List <BlogCategory> cList = _categoryService.GetCateList();

            cList.Insert(0, new BlogCategory {
                CateID = 0, CateName = "全部分类", State = 1, ParentID = 0
            });
            SelectList CateList = new SelectList(cList, "CateID", "CateName");

            ViewData["CateID"] = CateList;
            ISpecification <BlogArticle> condition = new DirectSpecification <BlogArticle>(x => x.ArticleID > 0);
            PageData <BlogArticle>       aList     = _articleService.FindAll <int>(pageIndex.Value, pageSize.Value, condition, x => x.ArticleID, true);
            PagedList <BlogArticle>      pList     = new PagedList <BlogArticle>(aList.DataList, pageIndex.Value, pageSize.Value, aList.TotalCount);

            ViewData["pList"] = pList;

            return(View());
        }