LINQ 的使用
来源:互联网 发布:在线网络理财产品排名 编辑:程序博客网 时间:2024/04/30 17:57
<1>
LINQ
using System;using System.Collections.Generic;using System.Data.Entity;using System.Linq;using System.Text;using System.Web;using System.Web.Mvc;using ZuCheMvcApp.Common;using ZuCheMvcApp.Models;using ZuCheMvcApp.Models.select;namespace ZuCheMvcApp.Client{ /// <summary> /// 处理前台页面的显示 /// </summary> public class ClientController : BaseController { private ZuCheDBEntities db = new ZuCheDBEntities(); #region 首页 /// <summary> /// 前台首页 /// </summary> /// <returns></returns> public ActionResult Home() { return View(); } #endregion #region 地图 /// <summary> /// 首页的地图显示 /// </summary> /// <returns></returns> public ActionResult IndexMap() { return View("module/IndexMap"); } /// <summary> /// 其他页的地图显示 /// </summary> /// <returns></returns> public ActionResult Map() { return View("module/Map"); } /// <summary> /// 某个城市的所有门店分布图 /// </summary> /// <returns></returns> public ActionResult StoreMap() { //获取城市id和名称 CityIdAndNameModel cityModel = new CityIdAndNameModel(); if (Request["cityId"] == null) cityModel = base.getCurCityByIpAddress(); else cityModel = ClientHelper.getCurCityByCityId(Convert.ToInt32(Request["cityId"])); //城市区域id int _distId = 0; if (Request["distId"] != null) { _distId = Convert.ToInt32(Request["distId"]); cityModel = (from c in db.CR_BC_CITY join d in db.CR_BC_CITY_DISTRICT on c.CR_BC_CITY_ID equals d.CR_BC_CITY_ID where d.CR_BC_CITY_DISTRICT_ID == _distId select new CityIdAndNameModel { CityId = c.CR_BC_CITY_ID, CityName = c.CITY_NAME }).FirstOrDefault(); } ViewBag.CurrentDistId = _distId; //门店id int _storeId = 0; if (Request["storeId"] != null) { _storeId = Convert.ToInt32(Request["storeId"]); cityModel = (from s in db.CR_BC_STORE join c in db.CR_BC_CITY on s.CR_BC_CITY_ID equals c.CR_BC_CITY_ID where s.CR_BC_STORE_ID == _storeId select new CityIdAndNameModel { CityId = c.CR_BC_CITY_ID, CityName = c.CITY_NAME }).FirstOrDefault(); } ViewBag.CurrentStoreId = _storeId; ViewBag.CurrentCityId = cityModel.CityId; ViewBag.CurrentCityName = cityModel.CityName; //获取指定城市的所有区域信息 List<DistrictModel> listDistrict = (from d in db.CR_BC_CITY_DISTRICT where d.CR_BC_CITY_ID == cityModel.CityId select new DistrictModel { CR_BC_CITY_DISTRICT_ID = d.CR_BC_CITY_DISTRICT_ID, CITY_DISTRICT_NAME = d.CITY_DISTRICT_NAME }).ToList(); ViewBag.listDistrict = listDistrict; //获取指定城市的所有门店信息 List<StoreModel> listStore = (from s in db.CR_BC_STORE join d in db.CR_BC_CITY_DISTRICT on s.CR_BC_CITY_DISTRICT_ID equals d.CR_BC_CITY_DISTRICT_ID where s.CR_BC_CITY_ID == cityModel.CityId select new StoreModel { CR_BC_STORE_ID = s.CR_BC_STORE_ID, STORE_NAME = s.STORE_NAME, CR_BC_CITY_DISTRICT_ID = s.CR_BC_CITY_DISTRICT_ID, CITY_DISTRICT_NAME = d.CITY_DISTRICT_NAME, START_WORK_TIME = s.START_WORK_TIME, END_WORK_TIME = s.END_WORK_TIME }).ToList(); ViewBag.listStore = listStore; ViewBag.listStoreCount = listStore.Count(); //门店总数 //热门城市 List<CityIdAndNameModel> listHotCity = db.CR_BC_CITY.Where(x => x.ISTOP == true).Select(n => new CityIdAndNameModel { CityId = n.CR_BC_CITY_ID, CityName = n.CITY_NAME }).ToList(); ViewBag.listHotCity = listHotCity; //租车攻略 ViewBag.ZCJY = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 3).OrderByDescending(o => o.CREATED_TIME).Take(12).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE }); //特惠活动 ViewBag.huodong = db.CR_MS_ACTIVITY.OrderByDescending(o => o.DATE_ISSUED).Take(2); return View("module/StoreMap"); } #endregion #region 公司简介、愿景与使命、公司大事记、公司荣誉、合作伙伴、联系我们。加盟合作、隐私保护 /************************************ 关于我们 start ************************************/ /// <summary> /// 关于我们: 公司简介、愿景与使命、公司大事记、公司荣誉、合作伙伴、联系我们。加盟合作、隐私保护 /// </summary> /// <param name="categoryName"></param> /// <returns></returns> public ActionResult About(string categoryName) { switch (categoryName) { case "gywm": //公司简介 ViewBag.Title = "公司简介"; ViewBag.Content = db.CR_MS_ABOUT_US.Where(x => x.CLASSIFICATION == 1).Select(n => (string)n.PAGE_HTML).FirstOrDefault(); break; case "yjsm": //愿景与使命 ViewBag.Title = "愿景与使命"; ViewBag.Content = db.CR_MS_ABOUT_US.Where(x => x.CLASSIFICATION == 2).Select(n => (string)n.PAGE_HTML).FirstOrDefault(); break; case "hzhb": //合作伙伴 ViewBag.Title = "合作伙伴"; ViewBag.Content = db.CR_MS_ABOUT_US.Where(x => x.CLASSIFICATION == 3).Select(n => (string)n.PAGE_HTML).FirstOrDefault(); break; case "lxwm": //联系我们 ViewBag.Title = "联系我们"; ViewBag.Content = db.CR_MS_ABOUT_US.Where(x => x.CLASSIFICATION == 4).Select(n => (string)n.PAGE_HTML).FirstOrDefault(); break; case "gsds": //公司大事记 ViewBag.Title = "公司大事记"; StringBuilder aboutyearHtml = new StringBuilder(); StringBuilder aboutyearinfoHtml = new StringBuilder(); int curYear = 0; int index = 0; List<CR_MS_ABOUT_EVENT> list = db.CR_MS_ABOUT_EVENT.OrderByDescending(o => o.DATE_ISSUED).ToList(); aboutyearinfoHtml.Append("<ul>"); foreach (var a in list) { if (curYear != a.DATE_ISSUED.Year) { curYear = a.DATE_ISSUED.Year; aboutyearinfoHtml.Append("</ul>"); if (index == 0) { aboutyearinfoHtml.Append("<ul class=\"contnwlst\" style=\"display:block;\">"); aboutyearHtml.Append("<li class=\"hover\" onmouseover=\"setTabs(0," + index + ")\">" + curYear + "年</li>"); } else { aboutyearinfoHtml.Append("<ul class=\"contnwlst\" style=\"display:none;\">"); aboutyearHtml.Append("<li onmouseover=\"setTabs(0," + index + ")\">" + curYear + "年</li>"); } index++; } if (string.IsNullOrEmpty(a.LINK_URL)) aboutyearinfoHtml.Append("<li><span class=\"floatlft\">•</span> <span class=\"floatrgt\">" + a.DATE_ISSUED.Year + "." + a.DATE_ISSUED.Month + "</span><div>" + a.TITLE + "</div></li>"); else aboutyearinfoHtml.Append("<li><span class=\"floatlft\">•</span> <span class=\"floatrgt\">" + a.DATE_ISSUED.Year + "." + a.DATE_ISSUED.Month + "</span><div><a href=\"" + a.LINK_URL + "\">" + a.TITLE + "</a></div></li>"); } aboutyearinfoHtml.Append("</ul>"); ViewBag.aboutyearHtml = aboutyearHtml.ToString(); ViewBag.aboutyearinfoHtml = aboutyearinfoHtml.ToString().Replace("<ul></ul>", ""); break; case "gsry": //公司荣誉 ViewBag.Title = "公司荣誉"; StringBuilder aboutyearHtml_2 = new StringBuilder(); StringBuilder aboutyearinfoHtml_2 = new StringBuilder(); int curYear_2 = 0; int index_2 = 0; List<CR_MS_ABOUT_HONOR> list_2 = db.CR_MS_ABOUT_HONOR.OrderByDescending(o => o.YEAR_ISSUED).ToList(); aboutyearinfoHtml_2.Append("<ul>"); foreach (var a in list_2) { if (curYear_2 != a.YEAR_ISSUED) { curYear_2 = a.YEAR_ISSUED; aboutyearinfoHtml_2.Append("</ul>"); if (index_2 == 0) { aboutyearinfoHtml_2.Append("<ul class=\"contnwlst\" style=\"display:block;\">"); aboutyearHtml_2.Append("<li class=\"hover\" onmouseover=\"setTabs(0," + index_2 + ")\">" + curYear_2 + "年</li>"); } else { aboutyearinfoHtml_2.Append("<ul class=\"contnwlst\" style=\"display:none;\">"); aboutyearHtml_2.Append("<li onmouseover=\"setTabs(0," + index_2 + ")\">" + curYear_2 + "年</li>"); } index_2++; } if (string.IsNullOrEmpty(a.LINK_URL)) aboutyearinfoHtml_2.Append("<li><span class=\"floatlft\">•</span><div>" + a.TITLE + "</div><span class=\"floatrgt\">" + a.SOURCE_WEBSITE + "</span></li>"); else aboutyearinfoHtml_2.Append("<li><span class=\"floatlft\">•</span><div><a href=\"" + a.LINK_URL + "\" target=\"_blank\">" + a.TITLE + "</a></div> <span class=\"floatrgt\">" + a.SOURCE_WEBSITE + "</span></li>"); } aboutyearinfoHtml_2.Append("</ul>"); ViewBag.aboutyearHtml = aboutyearHtml_2.ToString(); ViewBag.aboutyearinfoHtml = aboutyearinfoHtml_2.ToString().Replace("<ul></ul>", ""); break; case "jiameng": //加盟合作 ViewBag.Title = "租车“百城千店”加盟计划,全国三四线城市火热召集中,租车云时代的创富新机会!"; break; case "ysbh": //隐私保护 ViewBag.Title = "租车隐私保护,租车信息保密"; break; } return View("about/" + categoryName); } /************************************ 关于我们 end ************************************/ #endregion #region 网站导航、帮助中心 /// <summary> /// 网站导航/帮助中心 /// </summary> /// <returns></returns> public ActionResult help(string categoryName) { switch (categoryName) { case "fwgz": ViewBag.Title = "服务规则"; break; case "xssl": ViewBag.Title = "注册和登陆"; break; case "mdyd": ViewBag.Title = "门店预定"; break; case "wzyd": ViewBag.Title = "网站预定"; break; case "dhyd": ViewBag.Title = "电话预定"; break; case "app": ViewBag.Title = "手机预定"; break; case "cjwt": ViewBag.Title = "预订常见问题_取车常见问题"; ViewBag.Content = db.CR_MS_FAQ.Where(x => x.CLASSIFICATION == 1).ToList(); break; case "hcjs": ViewBag.Title = "还车及结算"; ViewBag.Content = db.CR_MS_FAQ.Where(x => x.CLASSIFICATION == 2).ToList(); break; case "bxfw": ViewBag.Title = "保险服务"; ViewBag.Content = db.CR_MS_FAQ.Where(x => x.CLASSIFICATION == 3).ToList(); break; case "jjfw": ViewBag.Title = "紧急服务"; ViewBag.Content = db.CR_MS_FAQ.Where(x => x.CLASSIFICATION == 4).ToList(); break; case "hyfw": ViewBag.Title = "会员服务"; ViewBag.Content = db.CR_MS_FAQ.Where(x => x.CLASSIFICATION == 5).ToList(); break; case "xxzc": ViewBag.Title = "限行政策"; ViewBag.Content = db.CR_MS_FAQ.Where(x => x.CLASSIFICATION == 6).ToList(); break; case "qt": ViewBag.Title = "其他"; ViewBag.Content = db.CR_MS_FAQ.Where(x => x.CLASSIFICATION == 7).ToList(); break; } return View("help/" + categoryName); } /// <summary> /// 帮助中心 - 列表详细内容页 /// </summary> /// <returns></returns> public ActionResult help_FAQ(string categoryName, int id) { switch (categoryName) { case "cjwt": ViewBag.Title = "预订常见问题_取车常见问题"; break; case "hcjs": ViewBag.Title = "还车及结算"; break; case "bxfw": ViewBag.Title = "保险服务"; break; case "jjfw": ViewBag.Title = "紧急服务"; break; case "hyfw": ViewBag.Title = "会员服务"; break; case "xxzc": ViewBag.Title = "限行政策"; break; case "qt": ViewBag.Title = "其他"; break; } ViewBag.Model = db.CR_MS_FAQ.Where(x => x.CR_MS_FAQ_ID == id).FirstOrDefault(); return View("help/" + categoryName + "_info"); } #endregion #region 新闻中心:公司动态、媒体报道、租车攻略 /// <summary> /// 新闻中心 /// </summary> /// <returns></returns> public ActionResult news(string categoryName) { int pn = Request["pn"] == null ? 1 : int.Parse(Request["pn"]); //当前页码 int ps = 20; //每页的记录数 switch (categoryName) { case "index": ViewBag.Title = "新闻中心首页"; ps = 7; //公司动态 ViewBag.List_GSDT = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 1).OrderByDescending(o => o.CREATED_TIME).Take(ps).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE, TOP_IMG = n.TOP_IMG }); //媒体报道 ViewBag.List_MTBD = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 2).OrderByDescending(o => o.CREATED_TIME).Take(ps).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE, TOP_IMG = n.TOP_IMG }); //租车攻略 ViewBag.List_ZCJY = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 3).OrderByDescending(o => o.CREATED_TIME).Take(ps).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE, TOP_IMG = n.TOP_IMG }); //特惠活动 ViewBag.List_Huodong = db.CR_MS_ACTIVITY.OrderByDescending(o => o.DATE_ISSUED).Take(ps).ToList().Select(n => new CR_MS_ACTIVITY { CR_MS_ACTIVITY_ID = n.CR_MS_ACTIVITY_ID, TITLE = n.TITLE, LINK_URL = n.LINK_URL, PIC = n.PIC }); //前七条浏览量最高的新闻 ViewBag.TopList = db.CR_MS_NEWS.OrderByDescending(o => o.PAGE_VIEW).Take(ps).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE, CLASSIFICATION = n.CLASSIFICATION }); break; case "gsdt": ViewBag.Title = "公司动态"; ViewBag.List = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 1).OrderByDescending(o => o.CREATED_TIME).Skip((pn - 1) * ps).Take(ps).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE, DATE_ISSUED = n.DATE_ISSUED }); ViewBag.ListCount = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 1).Count(); break; case "mtbd": ViewBag.Title = "媒体报道"; ViewBag.List = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 2).OrderByDescending(o => o.CREATED_TIME).Skip((pn - 1) * ps).Take(ps).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE, DATE_ISSUED = n.DATE_ISSUED }); ViewBag.ListCount = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 2).Count(); break; case "zcjy": ViewBag.Title = "租车攻略"; ViewBag.List = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 3).OrderByDescending(o => o.CREATED_TIME).Skip((pn - 1) * ps).Take(ps).ToList().Select(n => new CR_MS_NEWS { CR_MS_NEWS_ID = n.CR_MS_NEWS_ID, TITLE = n.TITLE, DATE_ISSUED = n.DATE_ISSUED }); ViewBag.ListCount = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 3).Count(); break; } return View("news/" + categoryName); } /// <summary> /// 新闻中心 - 详细页 /// </summary> /// <returns></returns> public ActionResult news_info(string categoryName, int id) { //根据id查询详细信息 CR_MS_NEWS cr_ms_news = db.CR_MS_NEWS.Where(x => x.CR_MS_NEWS_ID == id).FirstOrDefault(); if (cr_ms_news == null) return Redirect("/page/404.html"); ViewBag.Content = cr_ms_news; ViewBag.Title = ViewBag.Content.TITLE; //访问量+1 cr_ms_news.PAGE_VIEW = cr_ms_news.PAGE_VIEW + 1; db.SaveChanges(); //返回视图 return View("news/" + categoryName + "_info"); } #endregion #region 特惠活动 public ActionResult huodong() { int pn = Request["pn"] == null ? 1 : int.Parse(Request["pn"]); //当前页码 int ps = 6; //每页的记录数 ViewBag.Title = "新闻中心_特惠活动"; ViewBag.List = db.CR_MS_ACTIVITY.OrderByDescending(o => o.DATE_ISSUED).Skip((pn - 1) * ps).Take(ps); ViewBag.ListCount = db.CR_MS_NEWS.Where(x => x.CLASSIFICATION == 1).Count(); return View("nav/huodong"); } #endregion #region 短租自驾 public ActionResult duanzu() { ViewBag.Title = "短租自驾,短期租车,自驾预订"; //获取有关参数 int fromCityId = Convert.ToInt32(Request["fromCityId"]); //取车城市id string fromCityName = Convert.ToString(Request["fromCityName"]); //取车城市名称 int fromStoreId = Convert.ToInt32(Request["fromStoreId"]); //取车门店id string fromStoreName = Convert.ToString(Request["fromStoreName"]); //取车门店名称 int sendType = Convert.ToInt32(Request["sendType"]); //是否送车上门,1:否,2:是 string sendAddress = Convert.ToString(Request["sendAddress"]); //送车上门的地址 DateTime fromTime = Convert.ToDateTime(Request["fromTime"]); //取车时间 int toCityId = Convert.ToInt32(Request["toCityId"]); //还车城市id string toCityName = Convert.ToString(Request["toCityName"]); //还车城市名称 int toStoreId = Convert.ToInt32(Request["toStoreId"]); //还车门店id string toStoreName = Convert.ToString(Request["toStoreName"]); //还车门店名称 int pickType = Convert.ToInt32(Request["pickType"]); //是否上门取车,1:否,2:是 string pickAddress = Convert.ToString(Request["pickAddress"]); //上门取车的地址 DateTime toTime = Convert.ToDateTime(Request["toTime"]); //还车时间 CityIdAndNameModel CurCityByIpAddressModel = base.getCurCityByIpAddress(); /********************** 取车信息重设置 *********************/ //获取当前(取车)城市id fromCityId = fromCityId == 0 ? CurCityByIpAddressModel.CityId : fromCityId; fromCityName = string.IsNullOrEmpty(fromCityName) ? CurCityByIpAddressModel.CityName : fromCityName; //获取当前(取车)门店的详细信息 CR_BC_STORE cR_BC_STORE = fromStoreId == 0 ? db.CR_BC_STORE.Where(x => x.CR_BC_CITY_ID == fromCityId).FirstOrDefault() : db.CR_BC_STORE.Where(x => x.CR_BC_STORE_ID == fromStoreId).FirstOrDefault(); ViewBag.fromStoreInfo = cR_BC_STORE; fromStoreId = cR_BC_STORE.CR_BC_STORE_ID; fromStoreName = cR_BC_STORE.STORE_NAME; fromTime = fromTime == DateTime.MinValue ? Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 10:00")).AddDays(1) : fromTime; /********************** 还车信息重设置 *********************/ //获取当前(取车)城市id toCityId = toCityId == 0 ? CurCityByIpAddressModel.CityId : toCityId; toCityName = string.IsNullOrEmpty(toCityName) ? CurCityByIpAddressModel.CityName : toCityName; //获取当前(取车)门店的详细信息 cR_BC_STORE = toStoreId == 0 ? db.CR_BC_STORE.Where(x => x.CR_BC_CITY_ID == toCityId).FirstOrDefault() : db.CR_BC_STORE.Where(x => x.CR_BC_STORE_ID == toStoreId).FirstOrDefault(); ViewBag.toStoreInfo = cR_BC_STORE; toStoreId = cR_BC_STORE.CR_BC_STORE_ID; toStoreName = cR_BC_STORE.STORE_NAME; toTime = toTime == DateTime.MinValue ? Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd 10:00")).AddDays(3) : toTime; //向控制器传值 ViewBag.fromCityId = fromCityId; ViewBag.fromCityName = fromCityName; ViewBag.fromStoreId = fromStoreId; ViewBag.fromStoreName = fromStoreName; ViewBag.sendType = sendType; ViewBag.sendAddress = sendAddress; ViewBag.fromTime = fromTime; ViewBag.fromDate = fromTime.ToString("yyyy-MM-dd"); ViewBag.fromHourMinute = fromTime.ToString("HH:mm"); ViewBag.toCityId = toCityId; ViewBag.toCityName = toCityName; ViewBag.toStoreId = toStoreId; ViewBag.toStoreName = toStoreName; ViewBag.pickType = pickType; ViewBag.pickAddress = pickAddress; ViewBag.toTime = toTime; ViewBag.toDate = toTime.ToString("yyyy-MM-dd"); ViewBag.toHourMinute = toTime.ToString("HH:mm"); return View("nav/duanzu"); } #endregion #region 汽车详细信息 public ActionResult cardetail(int id) { //根据id查询汽车详细信息 //do something... return View("module/cardetail"); } #endregion #region 租车在线预订 public ActionResult order() { ViewBag.Title = "在线预订租车"; ViewData[""] = 1; int param_id = Request["param_id"] == null ? 0 : int.Parse(Request["param_id"]); int param_fromCityId = Request["param_fromCityId"] == null ? 0 : int.Parse(Request["param_fromCityId"]); int param_fromStoreId = Request["param_id"] == null ? 0 : int.Parse(Request["param_fromStoreId"]); string param_sentAddress = Request["param_sentAddress"] == null ? "" : Convert.ToString(Request["param_sentAddress"]); string param_fromDate = Request["param_fromDate"] == null ? "" : Convert.ToString(Request["param_fromDate"]); string param_fromHourMinute = Request["param_fromDate"] == null ? "" : Convert.ToString(Request["param_fromHourMinute"]); int param_toCityId = Request["param_toCityId"] == null ? 0 : int.Parse(Request["param_toCityId"]); int param_toStoreId = Request["param_toStoreId"] == null ? 0 : int.Parse(Request["param_toStoreId"]); string param_pickAddress = Request["param_pickAddress"] == null ? "" : Convert.ToString(Request["param_pickAddress"]); string param_toDate = Request["param_toDate"] == null ? "" : Convert.ToString(Request["param_toDate"]); string param_toHourMinute = Request["param_fromDate"] == null ? "" : Convert.ToString(Request["param_toHourMinute"]); //do something... return View("module/order/preorder"); } #endregion #region 专车 public ActionResult zhuanche() { ViewBag.Title = "接机、送机,预约用车,专人专车,随叫随到"; //读取数据 //do something... return View("nav/zhuanche"); } #endregion #region 长租服务 public ActionResult changzu() { ViewBag.Title = "公司长期租车|个人长期租车|长租预订|长租用车|价格"; //读取数据 //do something... return View("nav/changzu"); } #endregion #region 长租服务 public ActionResult carbusiness() { ViewBag.Title = "企业云方案,开创企业全新商务用车之道"; //读取数据 //do something... return View("nav/carbusiness"); } #endregion #region 顺风车站 public ActionResult easyride( ) { ViewBag.Title = "100元顺风车,顺风车站租车预订_顺风租车城市|108款车型|超低价格"; //读取数据 //do something... return View("nav/easyride"); } //顺风车的详细信息 public ActionResult easyrideInfo(int id) { ViewBag.Title = "100元顺风车,顺风车站租车预订_顺风租车城市|108款车型|超低价格"; //读取数据 //do something... return View("module/easyrideInfo"); } #endregion #region 门店查询 public ActionResult service() { ViewBag.Title = "中国最大租车公司|全国门店查询系统"; //所有城市 List<CR_BC_CITY> listCity = db.CR_BC_CITY.ToList().Select(n => new CR_BC_CITY { CR_BC_CITY_ID = n.CR_BC_CITY_ID, CITY_NAME = n.CITY_NAME, EN_NAME = n.EN_NAME, ISTOP = n.ISTOP }).OrderBy(o => o.EN_NAME).ToList(); ViewBag.listCity = listCity; //热门城市 List<CityIdAndNameModel> listHotCity = listCity.Where(x => x.ISTOP == true).Select(n => new CityIdAndNameModel { CityId = n.CR_BC_CITY_ID, CityName = n.CITY_NAME, }).ToList(); ViewBag.listHotCity = listHotCity; return View("nav/service"); } #endregion #region 国际租车 public ActionResult international() { ViewBag.Title = "国际租车,自由愉悦的全球自驾从此开始,在线预订"; return View("nav/international"); } public ActionResult international_module(string categoryName) { ViewBag.Title = "国际租车,自由愉悦的全球自驾从此开始,在线预订"; return View("module/international/" + categoryName); } #endregion #region 会员 public ActionResult member(string categoryName, string pageName) { //ViewBag.Title = ""; //do something... return View("member/" + categoryName + "/" + pageName); } #endregion }}
0 0
- Linq 使用的想法!
- viewState+linq的使用
- Linq--OrderBy 的使用
- LINQ 的使用
- linq的使用
- c# LINQ的使用
- VS2008之 LINQ的使用
- linq实例 - Group的使用
- Linq to SQlite的使用
- LINQ使用的一点心得
- Linq to SQlite的使用
- linq 中Union的使用
- C# Linq的简单使用
- C# Linq Distinct的使用
- Linq查询的简单使用
- linq to Object的使用
- Linq中的Aggragate的使用
- C#LinQ语句的使用
- 使用X-UA-Compatible来设置IE浏览器兼容模式
- handler 进行主线程与子线程之间的信息传递
- c#----泛型(一)
- maven指定依赖打成一个jar包
- struts2的result-type详解
- LINQ 的使用
- vmware workstation11下安装ubuntu14.04
- java汉字转拼音
- 【leetcode】Majority Element
- 第4周项目3-用对象数组操作长方体类
- js如何生成动态正则表达式?
- 安装ADT
- R语言学习笔记(二)
- Win8系统108个运行命令 你能记住多少?(转)