예제 #1
0
        // GET: Admin/Content
        public ActionResult Index()
        {
            var dao   = new ContentDao();
            var model = dao.ListAll();

            return(View(model));
        }
예제 #2
0
        public ActionResult Index(int page = 1, int PageSize = 10)
        {
            var dao   = new ContentDao();
            var model = dao.ListAll(page, PageSize);

            return(View(model));
        }
        // GET: Admin/Content
        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new ContentDao();
            var model = dao.ListAll(searchString, page, pageSize);

            ViewBag.searchString = searchString;
            return(View(model));
        }
예제 #4
0
        // GET: Admin/Content
        public ActionResult Index(string name, string state = "0", string categoryID = "0", int page = 1, int pageSize = 8)
        {
            var contentDao = new ContentDao();

            int totalRecord = 0;
            List <ContentViewModel> list = contentDao.ListAll(name, int.Parse(state), long.Parse(categoryID), ref totalRecord, page, pageSize);

            ViewBag.TotalRecord = totalRecord;
            ViewBag.CurrentPage = page;

            int maxPage   = 5;
            int totalPage = 0;

            totalPage            = (int)Math.Ceiling((double)(totalRecord * 1.0 / pageSize));
            ViewBag.TotalPage    = totalPage;
            ViewBag.MaxPage      = maxPage;
            ViewBag.FirstPage    = 1;
            ViewBag.LastPage     = totalPage;
            ViewBag.NextPage     = page + 1;
            ViewBag.PreviousPage = page - 1;

            if (Int32.Parse(state) == 0)
            {
                ViewBag.AllState = "selected";
            }
            else if (Int32.Parse(state) == -1)
            {
                ViewBag.LockState = "selected";
            }
            else if (Int32.Parse(state) == 1)
            {
                ViewBag.OpenState = "selected";
            }
            ViewBag.State      = state;
            ViewBag.Name       = name;
            ViewBag.CategoryID = long.Parse(categoryID);

            SetViewBagCategory(long.Parse(categoryID), true);

            return(View(list));
        }