Ejemplo n.º 1
0
        public static string?ErrorMessageOf(this IEnumerable <ValidationResult> validationResults, string propertyName)
        {
            ThrowIf.Null(validationResults, nameof(validationResults));
            ThrowIf.NullOrEmpty(propertyName, nameof(propertyName));

            foreach (ValidationResult result in validationResults)
            {
                if (result.MemberNames.Contains(propertyName))
                {
                    return(result.ErrorMessage);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        public static bool ExistErrorOf(this IEnumerable <ValidationResult> valiationResults, string propertyName)
        {
            ThrowIf.Null(valiationResults, nameof(valiationResults));
            ThrowIf.NullOrEmpty(propertyName, nameof(propertyName));

            foreach (ValidationResult result in valiationResults)
            {
                if (result.MemberNames.Contains(propertyName))
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 3
0
        public static bool ExistError(this IEnumerable <ValidationResult> valiationResults)
        {
            ThrowIf.Null(valiationResults, nameof(valiationResults));

            return(valiationResults.Any());
        }