public ActionResult AddBlogArtcle()
 {
     BlogArticles model = new BlogArticles();
     if (Request.Cookies["loginid"] != null)
     {
         List<EssayCategory> ca = categorybll.GetEssayCategoryByMemberid(int.Parse(Request.Cookies["loginid"].Value.ToString()));
         ViewData["UserCategoryID"] = new SelectList(ca, "ID", "EssayCategoryName","-请选择-");
     }
     return View();
 }
 public ActionResult PartialBlogView(int pageindex = 1, int pagesize = 10)
 {
     BlogArticles model = new BlogArticles();
     model.PageSize =pagesize;
     model.PageIndex = pageindex;
     DataTable tbl = new DataTable("Articles");
     tbl = bll.GetBlogArticleByPage(model);
     int totalItems = (int)tbl.Rows[0]["totalcount"]; //要分页的总记录数
     //PagedList构造函数
     PagedList<DataRow> arts = new PagedList<DataRow>(tbl.Select(), pageindex, pagesize, totalItems);
     return PartialView("_BlogArtclePartialView", arts);
 }
 public ActionResult BlogList(int id = 1)
 {
     BlogArticles model = new BlogArticles();
     model.PageSize = 5;
     model.PageIndex = id;
     DataTable tbl = new DataTable("Articles");
     tbl = bll.GetBlogArticleByPage(model);
     int totalItems = (int)tbl.Rows[0]["totalcount"]; //要分页的总记录数
     //PagedList构造函数
     PagedList<DataRow> arts = new PagedList<DataRow>(tbl.Select(), id, 5, totalItems);
     return View(arts);
 }
 public ActionResult AddBlogArtcle(BlogArticles model)
 {
     if (Request.Cookies["loginid"] != null)
     {
         model.CreaterID = int.Parse(Request.Cookies["loginid"].Value.ToString());
         List<EssayCategory> ca = categorybll.GetEssayCategoryByMemberid(int.Parse(Request.Cookies["loginid"].Value.ToString()));
         ViewData["UserCategoryID"] = new SelectList(ca, "ID", "EssayCategoryName", "-请选择-");
     }
     if (Request.Cookies["loginuser"] != null)
     { model.CreaterName = HttpUtility.UrlDecode(Request.Cookies["loginuser"].Value.ToString()); }
     bool issuccess = bll.InsertBlogArticle(model);
     return View(model);
 }