mvc.net分页查询案例——控制器(HomeController.cs)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using HouseSys.Models;
using HouseSys.BLL;

namespace HouseSys.Controllers.Home
{
    public class HomeController : Controller
    {
        StreetBLL streetBll = new StreetBLL();
        HouseTypeBLL typeBll = new HouseTypeBLL();
        HouseBLL houseBll = new HouseBLL();
       
        /// <summary>
        /// 进入首页
        /// 获取所有的房屋位置
        /// 获取所有的房型
        /// </summary>
        /// <returns></returns>
        public ActionResult Index(int pageIndex = 1,int pageSize = 5)
        {
            List<StreetModel> streetList = streetBll.GetStreets();
            List<HouseTypeModel> typeList = typeBll.GetHouseTypes();
            SelectList selectStree = new SelectList(streetList,"Id","Name");
            SelectList selectType = new SelectList(typeList, "Id", "Name");
            int AllCount = 0;
            List<HouseModel> houseList = houseBll.GetHousesAll(pageIndex,pageSize,out AllCount);
            ViewData["selectStree"] = selectStree;
            ViewData["selectType"] = selectType;
            PagedList<HouseModel> pageList = new PagedList<HouseModel>(houseList,pageIndex,pageSize,AllCount);

            return View(pageList);
        }

    }
}

上一篇:el-table 分页


下一篇:boost::gil::scale_lanczos用法的测试程序