Пример #1
0
        public static ApiValidationResult Aggregate(params ApiValidationResult[] results)
        {
            if (results == null)
            {
                return(Ok());
            }

            var result = new ApiValidationResult();

            results.SafeForEach(r => result.Append(r));

            return(result);
        }
Пример #2
0
        public static ApiValidationResult Aggregate(params ApiValidationError[] errors)
        {
            if (errors == null)
            {
                return(Ok());
            }

            var result = new ApiValidationResult();

            errors.ForEach(e => result.Append(e));

            return(result);
        }
Пример #3
0
        public ApiValidationResult Append(ApiValidationResult other)
        {
            if (other == null)
            {
                return(this);
            }

            Success &= other.Success;

            if (other.Errors != null)
            {
                EnsureErrorsPropertyIsNotNull();
                Errors.AddRange(other.Errors.Where(e => e != null));
            }

            return(this);
        }