예제 #1
0
        /// <summary>
        /// 参数合法性检查
        /// </summary>
        /// <param name="modelState"></param>
        /// <returns></returns>
        public virtual RequestParamsCheckResult RequestParamsCheck(RequestModelType request, ParamsCheckHelper paramsCheckHelper)
        {
            var result = new RequestParamsCheckResult()
            {
                Success = true
            };

            return(result);
        }
예제 #2
0
        /// <summary>
        /// 参数合法性检查
        /// </summary>
        /// <param name="modelState"></param>
        /// <returns></returns>
        public virtual RequestParamsCheckResult RequestParamsCheck(ModelStateDictionary modelState, RequestModelType request, ParamsCheckHelper paramsCheckHelper)
        {
            var result = new RequestParamsCheckResult()
            {
                Success = modelState.IsValid
            };

            foreach (var item in modelState.Values)
            {
                foreach (var error in item.Errors)
                {
                    if (!string.IsNullOrEmpty(error.ErrorMessage))
                    {
                        result.ErrorMessage = error.ErrorMessage.TrimEnd('。');
                        break;
                    }
                }
            }
            return(result);
        }