/// <summary> /// 广告列表 /// </summary> public ActionResult AdvertList(int adPosId = 0, int pageSize = 15, int pageNumber = 1) { PageModel pageModel = new PageModel(pageSize, pageNumber, Adverts.AdminGetAdvertCount(adPosId)); AdvertListModel model = new AdvertListModel() { PageModel = pageModel, AdPosId = adPosId, AdvertList = Adverts.AdminGetAdvertList(pageModel.PageSize, pageModel.PageNumber, adPosId) }; List <SelectListItem> itemList = new List <SelectListItem>(); itemList.Add(new SelectListItem() { Text = "全部广告位置", Value = "0" }); foreach (AdvertPositionInfo advertPositionInfo in Adverts.GetAllAdvertPosition()) { itemList.Add(new SelectListItem() { Text = advertPositionInfo.Title, Value = advertPositionInfo.AdPosId.ToString() }); } ViewData["advertPositionList"] = itemList; SiteUtils.SetAdminRefererCookie(Url.Action("advertlist")); return(View(model)); }
private void Load() { List <SelectListItem> itemList = new List <SelectListItem>(); itemList.Add(new SelectListItem() { Text = "请选择广告位置", Value = "0" }); foreach (AdvertPositionInfo advertPositionInfo in Adverts.GetAllAdvertPosition()) { itemList.Add(new SelectListItem() { Text = advertPositionInfo.Title, Value = advertPositionInfo.AdPosId.ToString() }); } ViewData["advertPositionList"] = itemList; ViewData["referer"] = SiteUtils.GetAdminRefererCookie(); }