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