public ActionResult List(int? newstype, int? id) { int _newstype = newstype.HasValue ? newstype.Value : 1; var newsTypes = new NewsType(); ViewBag.newstypes = newsTypes.GetList(); ViewBag.newstype = _newstype; var news = new News(); IList<Ba_News> baNewses = news.GetNews(_newstype, id.HasValue ? id.Value : 1); ViewBag.baNewses = baNewses; //page info int pagecount = 1; int pagestep = 5; int objectcount = news.GetCount(_newstype); if (objectcount % pagestep == 0) pagecount = objectcount / pagestep; else pagecount = objectcount / pagestep + 1; ////// //pagecount = 13; int currentpage = id.HasValue ? (int)id : 1; Common.HtmlPagerControl page = new Common.HtmlPagerControl(pagecount, 7, objectcount); page.CurrentPage = currentpage; page.HrefPage = "/news/list/" + newstype + "/"; page.SimpleTheme = true; page.NavigateNext = ">"; page.NavigatePrevious = "<"; ViewBag.pageinfo = page.Render(); return View(); }
// // GET: /SuperAdmin/NewsList/ public ActionResult Page(int? id) { ViewBag.jsInit = Public.SuperAdminCommon.JSInit("NewsManage", "NewsList"); var newstype = new NewsType(); ViewBag.newstype = newstype.GetList(); News dal = new News(); IList<Ba_News> news = dal.GetNews(id.HasValue ? (int)id : 1); int pagecount = 1; int pagestep = 18; int objectcount = dal.GetCount(); if (objectcount % pagestep == 0) pagecount = objectcount / pagestep; else pagecount = objectcount / pagestep + 1; ////// /////pagecount = 13; int currentpage = id.HasValue ? (int)id : 1; Common.HtmlPagerControl page = new Common.HtmlPagerControl(pagecount, 3, objectcount); page.CurrentPage = currentpage; page.HrefPage = "/superadmin/NewsList/page/"; ViewBag.pageinfo = page.Render(); return View(news); }
// // GET: /SuperAdmin/NewsOperate/ public ActionResult Index(int? id) { ViewBag.jsInit = Public.SuperAdminCommon.JSInit("NewsManage", "NewsOperate"); var newstype = new NewsType(); ViewBag.newstype = newstype.GetList(); var model = new Ba_News(); if (id != null) { News dal = new News(); model = dal.GetSingleById((int)id); } if (model == null) model = new Ba_News(); ViewBag.model = model; if (model.Ns_ID.Equals(0)) ViewBag.Title = "新增最新情報"; else ViewBag.Title = "更新最新情報"; return View(); }
// // GET: /News/ public ActionResult Index(int? id) { var newstype = new NewsType(); ViewBag.newstype = newstype.GetList(); News dal = new News(); var model = dal.GetSingleById(id.HasValue ? id.Value : 0); return View(model); }