public IActionResult ListUserPageActionByPageId(string type, int pageId)
        {
            IActionResult response   = null;
            BaseClass     baseClass  = new BaseClass();
            UserModels    userModels = new UserModels();
            RoleModels    roleModels = new RoleModels();
            User          cuser      = new User();

            var mess = string.Empty;
            var isOk = true;

            string lang = LanguageModels.ActiveLanguage().LangCultureName;

            type = type ?? "Admin";

            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);
            }

            List <UserPageAction> listAllPageAction = userModels.AdminGetAllPageAction(type, lang, pageId);

            response = Json(listAllPageAction);

            return(response);
        }
        public IActionResult ListUserPageAction(string type, string search, int?pageId, int?pageIndex, int?pageSize, string orderBy, string orderType)
        {
            IActionResult response   = null;
            BaseClass     baseClass  = new BaseClass();
            UserModels    userModels = new UserModels();
            RoleModels    roleModels = new RoleModels();
            User          cuser      = new User();

            var mess = string.Empty;
            var listPageActionView = new AdminListPageActionView();
            var isOk = true;

            string lang = LanguageModels.ActiveLanguage().LangCultureName;

            type = type ?? string.Empty;


            if (pageId == null)
            {
                pageId = 0;
            }

            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);
            }

            if (pageIndex == null || pageIndex == 0)
            {
                pageIndex = 1;
            }

            if (pageSize == null)
            {
                pageSize = 25;
            }

            if (string.IsNullOrEmpty(orderBy) || string.IsNullOrEmpty(orderType))
            {
                orderBy   = "actionName";
                orderType = "asc";
            }

            listPageActionView.ListUserPageAction = userModels.AdminGetAllPageAction(type, lang, search, (int)pageId, (int)pageIndex, (int)pageSize, orderBy, orderType, out int total_record);
            listPageActionView.CateType           = roleModels.GetRoleByRole(type);
            listPageActionView.PageIndex          = (int)pageIndex;
            listPageActionView.PageSize           = (int)pageSize;
            listPageActionView.TotalPage          = total_record > 0 ? (int)System.Math.Ceiling((double)total_record / (double)pageSize) : 0;
            listPageActionView.TotalRecord        = total_record;
            response = Json(listPageActionView);

            return(response);
        }