Пример #1
0
        //public ActionResult Article(int? p)
        //{
        //    int pageindex = p ?? 1;
        //    int pagesize = 10;
        //    int total = 0;
        //    ArticleList list = new ArticleList();
        //    JavaDLL dll = new JavaDLL();
        //    list.articles = dll.getArticle(pagesize, pageindex, out total).AsQueryable().ToPagedList(pageindex, pagesize);
        //    list.articles.TotalItemCount = total;
        //    list.articles.CurrentPageIndex = pageindex;
        //    list.categorys = dll.getCategorys();
        //    list.category = 0;//0代表全部
        //    return View(list);
        //}

        public ActionResult Article(int?c, int?p)
        {
            int         pageindex = p ?? 1;
            int         cate      = c ?? 0;
            int         pagesize  = 10;
            int         total     = 0;
            ArticleList list      = new ArticleList();
            JavaDLL     dll       = new JavaDLL();

            if (cate != 0)
            {
                list.articles = dll.getArticle(cate, pagesize, pageindex, out total).AsQueryable().ToPagedList(pageindex, pagesize);
            }
            else
            {
                list.articles = dll.getArticle(pagesize, pageindex, out total).AsQueryable().ToPagedList(pageindex, pagesize);
            }
            list.articles.TotalItemCount   = total;
            list.articles.CurrentPageIndex = pageindex;
            list.categorys = dll.getCategorys();
            list.category  = cate;
            list.dataBind();
            return(View(list));
        }