/// <summary> /// Creates a new instance of <see cref="ValidationErrorInfo"/>. /// </summary> /// <param name="instanceToClone">Instance to clone</param> /// <param name="forAjax">Indicates whether the resultant instance is to be returned in AJAX response</param> public ValidationErrorInfo(ValidationErrorInfo instanceToClone, bool forAjax = false) : this( instanceToClone.Message, (instanceToClone.Members != null) ? instanceToClone.Members.Select(m => (!forAjax) ? m : m.ToCamelCase()).ToArray() : null ) { }
private static ValidationErrorInfo[] GetValidationErrorInfos(AbpValidationException validationException) { var validationErrorInfos = new List <ValidationErrorInfo>(); foreach (var validationResult in validationException.ValidationErrors) { var validationError = new ValidationErrorInfo(validationResult.ErrorMessage); if (validationResult.MemberNames != null && validationResult.MemberNames.Any()) { validationError.Members = validationResult.MemberNames.Select(m => m.ToCamelCase()).ToArray(); } validationErrorInfos.Add(validationError); } return(validationErrorInfos.ToArray()); }
private static ValidationErrorInfo[] GetValidationErrorInfos(AbpValidationException validationException) { var validationErrorInfos = new List<ValidationErrorInfo>(); foreach (var validationResult in validationException.ValidationErrors) { var validationError = new ValidationErrorInfo(validationResult.ErrorMessage); if (validationResult.MemberNames != null && validationResult.MemberNames.Any()) { validationError.Members = validationResult.MemberNames.Select(m => m.ToCamelCase()).ToArray(); } validationErrorInfos.Add(validationError); } return validationErrorInfos.ToArray(); }