// GET: Admin
        public ActionResult ManageUsers(string Search_Data, int?Page_No, string Filter_Value)
        {
            var user = _getUser.GetAll();

            if (Search_Data != null)
            {
                Page_No = 1;
            }
            else
            {
                Search_Data = Filter_Value;
            }

            ViewBag.FilterValue = Search_Data;

            if (!string.IsNullOrEmpty(Search_Data))
            {
                user = user.Where(x => x.University.ToLower().Contains(Search_Data.ToLower()));
            }

            int Size_Of_Page = 2;
            int No_Of_Page   = (Page_No ?? 1);

            return(View(user.ToList().ToPagedList(No_Of_Page, Size_Of_Page)));
        }
示例#2
0
        public async Task <IActionResult> Get([FromQuery] PaginationFilter filter)
        {
            // filter pagination data
            var route       = Request.Path.Value;
            var validFilter = new PaginationFilter(filter.PageNumber, filter.PageSize);

            // get
            var response = await get.GetAll();

            // total data
            var totalUsers = response.Count;

            // pagination
            var data = response.Skip((validFilter.PageNumber - 1) * validFilter.PageSize)
                       .Take(validFilter.PageSize);


            // custom filter pagination information
            var pagedReponse = PaginationHelper.CreatePagedReponse <User>(data.ToList(), validFilter, totalUsers, uriService, route);

            return(CustomResponse(pagedReponse));
        }