public ActionResult Index() { //string search = Session["Search"].ToString(); var categories = categoriesBLL.GetDAL().GetList(5, 1); var activities = activitiesBLL.GetDAL().GetList(5, 1); Models.SearchViewModel searchvm = new Models.SearchViewModel(); searchvm.Categories = categories; searchvm.Activities = activities; return(View(searchvm)); }
// GET: Activities public ActionResult Index(int page = 1) { count = count != 0 ? count : activitiesBLL.GetDAL().GetALL().Count(); var categories = categoriesBLL.GetDAL().GetALL(); var activitiesCount = count; var activities = activitiesBLL.GetDAL().GetList(10, page); //一页展示10条数据,使用分页 Models.ActivitiesViewModel acvm = new Models.ActivitiesViewModel(); acvm.Activities = activities.ToList(); acvm.Categories = categories.ToList(); acvm.ActivitiesCount = activitiesCount; ViewBag.CurrentPageIndex = page; return(View(acvm)); }