private static string GetValidationErrorNarrative(OwValidationException validationException) { var detailBuilder = new StringBuilder(); detailBuilder.AppendLine(OwWebLocalizedMessages.ValidationNarrativeTitle); foreach (var validationResult in validationException.ValidationErrors) { detailBuilder.AppendFormat(" - {0}", validationResult.ErrorMessage); detailBuilder.AppendLine(); } return detailBuilder.ToString(); }
private static ValidationErrorInfo[] GetValidationErrorInfos(OwValidationException 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(); }