public IActionResult ListUserPage(string type, string search, int?parentId, int?pageIndex, int?pageSize) { IActionResult response = null; BaseClass baseClass = new BaseClass(); UserModels userModels = new UserModels(); RoleModels roleModels = new RoleModels(); User cuser = new User(); var mess = string.Empty; var listPageView = new AdminListPageView(); var isOk = true; string lang = LanguageModels.ActiveLanguage().LangCultureName; type = type ?? string.Empty; if (parentId == null) { parentId = -1; // get all } var action = userModels.GetActionByActionName(CommonGlobal.View); string typeAct = action != null?action.Id.ToString() : string.Empty; if (type == string.Empty) { isOk = false; response = Json(new { code = Constant.NotExist, message = Constant.MessageNotExist }); } if (!isOk) { return(response); } listPageView.ListUserPage = userModels.AdminGetAllPageFullTree(type, lang, search, (int)parentId, (int)pageIndex, (int)pageSize, out int totalRecord); listPageView.CateType = roleModels.GetRoleByRole(type); listPageView.PageIndex = (int)pageIndex; listPageView.PageSize = (int)pageSize; listPageView.TotalPage = totalRecord > 0 ? (int)System.Math.Ceiling((double)totalRecord / (double)pageSize) : 0; listPageView.TotalRecord = totalRecord; response = Json(listPageView); return(response); }