public virtual PageDataOutputDto <RoleDto> GetPage(RolePageInputDto vm)
        {
            PageDataOutputDto <RoleDto> pageData = null;

            using (var db = this.GetContext())
            {
                var query = from q in db.Role
                            where q.IsDelete == false
                            select new RoleDto
                {
                    Id         = q.Id,
                    IsSystem   = q.IsSystem,
                    Name       = q.Name,
                    CreateTime = q.CreateTime,
                    UpdateTime = q.UpdateTime
                };

                if (!string.IsNullOrEmpty(vm.Id))
                {
                    query = query.Where(q => q.Id == vm.Id);
                }

                if (!string.IsNullOrEmpty(vm.Keyword))
                {
                    var value = vm.Keyword.DbLike(DbLikeType.All);
                    query = query.Where(q => EF.Functions.Like(q.Name, value));
                }

                pageData = query.ToPage(vm);
            }

            return(pageData);
        }
        public IActionResult GetPageData(RolePageInputDto vm)
        {
            if (vm != null && this.ModelState.IsValid)
            {
                var data = this.roleService.GetPage(vm);

                return(Success(data));
            }

            return(Error());
        }
        public virtual PageDataOutputDto <RoleDto> GetPage(RolePageInputDto vm)
        {
            if (vm == null)
            {
                throw new ApiParamNullException(nameof(vm));
            }
            if (vm.PageIndex < 1)
            {
                throw new ApiParamException(nameof(vm.PageIndex));
            }
            if (vm.PageSize < 1)
            {
                throw new ApiParamException(nameof(vm.PageSize));
            }
            var pagedata = this.roleRepository.GetPage(vm);

            return(pagedata);
        }