public Dictionary <string, object> GetPaged(string keyword = null, string filter = null, string sort = "OrderId DESC", int page = 1, int pageSize = 6) { Dictionary <string, object> result = new Dictionary <string, object>(); try { int total = service.GetAll(filter).Count(); int totalPage = total / pageSize + (total % pageSize > 0 ? 1 : 0); if (page < 1) { page = 1; } if (page > totalPage) { page = totalPage; } var apiUsers = service.Paged(keyword, filter, sort, page, pageSize); result["totalPage"] = totalPage; result["curPage"] = page; result["Collection"] = apiUsers; } catch (Exception ex) { throw ex; } return(result); }