示例#1
0
        public void GetList()
        {
            Response.Cache.SetOmitVaryStar(true);
            //var data = new DbHelper.
            var msg   = new ResponseData();
            int page  = 1;
            int limit = 10;
            int count = 0;

            try
            {
                var Notice = new Notices();
                page = Convert.ToInt32(Request["page"]); if (page < 1)
                {
                    page = 1;
                }
                limit = Convert.ToInt32(Request["limit"]); if (limit > 99 || limit < 1)
                {
                    limit = 10;
                }
                msg.data = Notice.GetListByPages(page, limit, ref count);
            }
            catch
            { }

            Response.Write(msg.ToJson());
            Response.End();
        }
示例#2
0
        public ActionResult List()
        {
            Response.Cache.SetOmitVaryStar(true);
            int page  = 1;
            int limit = 10;
            int count = 0;

            try
            {
                var Notice = new Notices();
                page = Convert.ToInt32(Request["page"]); if (page < 1)
                {
                    page = 1;
                }
                limit = Convert.ToInt32(Request["limit"]); if (limit > 99 || limit < 1)
                {
                    limit = 10;
                }
                ViewBag.notices = Notice.GetListByPages(page, limit, ref count);
            }
            catch
            {
            }

            ViewBag.count = count; // 获取当前页数量
            ViewBag.page  = page;  // 获取当前页

            return(View());
        }