public JsonResult GetAll(int page = 1, int pageSize = 10) { int totalRow = 0; int from = (page - 1) * pageSize; var lstData = _elastic.GetAll(from, pageSize); if (lstData.Count() != 0) { totalRow = lstData[0].Total; } var paginationSet = new PaginationSet <Question>() { Items = lstData, Page = page, TotalCount = totalRow, MaxPage = pageSize, TotalPages = (int)Math.Ceiling((decimal)totalRow / pageSize) }; return(Json(paginationSet, JsonRequestBehavior.AllowGet)); }