• 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);
            }
    
        }
    }
    

  • 相关阅读:
    NewWords/13001400
    UIWebView加载Js以及Css文件
    驾校错题集合
    NewWords/15001600
    javascript动态添加、修改、删除对象的属性和方法
    NewWords/12001300
    NewWords/11001200
    NewWords/16001700
    NewWords/14001500
    JS与iOS之间的通信
  • 原文地址:https://www.cnblogs.com/a1111/p/12816210.html
Copyright © 2020-2023  润新知