// GET api/<controller> public UserListModel Get(int page, int rows) { int totalRecords; var model = new UserListModel { Rows = UserRepository.Search(string.Empty, page, rows, out totalRecords), Page = page, Total = (totalRecords / rows) + 1, Records = rows }; return model; }
public ActionResult ListPaging(string searchKey, int? page) { const int pagesize = 30; var pi = page == null ? 1 : page.Value; int totalrecord; var lstuser = UserRepository.Search(string.IsNullOrEmpty(searchKey) ? "" : searchKey, pi, pagesize, out totalrecord); var model = new UserListModel { Page = pi, Records = pagesize, Rows = lstuser, Total = totalrecord }; return View(model); }
public UserListModel Find(string user, int page, int rows) { if (string.IsNullOrEmpty(user)) user = string.Empty; int totalRecords; var model = new UserListModel { Rows = UserRepository.Search(user, page, rows, out totalRecords), Page = page, Total = (totalRecords / rows) + 1, Records = rows }; return model; }