// GET: Article public ActionResult List(string infoCategoryID = "", int page = 1) { Expression <Func <Info, bool> > exp = info => !info.IsDel && info.IsAvailable; if (!string.IsNullOrEmpty(infoCategoryID)) { exp = info => !info.IsDel && info.CategoryID == infoCategoryID; ViewBag.infoCategoryID = infoCategoryID; } var result = infoService.GetPagedList(exp, page, 5, orderby => orderby.OrderByDescending(info => info.UpdateDate).ThenByDescending(info => info.AddDate)); var InfoCategoryTypeList = CacheMaker.IISCache.GetOrSetThenGet("InfoCategoryType_Cache_Key", () => { return(cateService.GetQueryable(cate => cate.CateTypeID == "InfoCategoryType").OrderByDescending(c => c.UpdateDate).ThenByDescending(c => c.AddDate).Select(cate => new SelectListItem { Value = cate.ID, Text = cate.Name }).ToList()); }); ViewBag.InfoCategoryTypeList = InfoCategoryTypeList; return(View(result)); }
public ActionResult Index() { var list = infoService.GetPagedList(d => true, page, pageSize, modellist => modellist.OrderByDescending(d => d.AddDate)); return(View(list)); }