// // GET: /PartialView/ public ActionResult BlogHeader() { List <BlogCategory> cList = _categoryService.GetCateList(); ViewData["cList"] = cList; return(View()); }
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")); }
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()); }