Esempio n. 1
0
        public ActionResult Search(string search, int?page, int pageSize)
        {
            UserSeachViewModel model = new UserSeachViewModel();

            model.TotalCount = _iUserService.GetAll(search).Count();
            var pager = new Pager(model.TotalCount, page, pageSize);

            model.lstUser = _iUserService.GetAll(search)
                            .Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize).ToList();
            model.Pager = pager;
            return(PartialView("_userList", model));
        }
Esempio n. 2
0
        public ActionResult Index(int?page)
        {
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"];
            }
            UserSeachViewModel model = new UserSeachViewModel();

            try
            {
                model.TotalCount = _iUserService.GetAll().Count();
                var pager = new Pager(model.TotalCount, page, 5);
                model.lstUser = _iUserService.GetAll()
                                .Skip((pager.CurrentPage - 1) * pager.PageSize).Take(pager.PageSize).ToList();
                model.Pager = pager;
                return(View(model));
            }
            catch (Exception ex)
            {
                ViewBag.Message = helper.GenerateMessage(" " + ex.Message, MessageType.Error);
            }
            return(View(model));
        }