Ejemplo n.º 1
0
        public static Exception Validate(this IFiledList fields)
        {
            Exception error = null;

            foreach (var field in fields)
            {
                if (!field.IsValid)
                {
                    error = field.Error;
                    break;
                }
            }
            return(error);
        }
Ejemplo n.º 2
0
        public static List <Exception> ValidateAll(this IFiledList fields)
        {
            List <Exception> errors = null;

            foreach (var field in fields)
            {
                if (!field.IsValid)
                {
                    if (errors == null)
                    {
                        errors = new List <Exception>();
                    }
                    errors.Add(field.Error);
                    break;
                }
            }
            return(errors);
        }