예제 #1
0
 public void Add <TResponse>(SingleResponse <TResponse> response)
 {
     if (response != null)
     {
         if (response.IsOk)
         {
             Infos.Add(response.Message);
             Infos = Infos.Select(x => x).Distinct().ToList();
         }
         else
         {
             if (response.Validations.Any())
             {
                 Validations.AddRange(response.Validations);
             }
             else
             {
                 Errors.Add(response.Message);
                 Errors = Errors.Select(x => x).Distinct().ToList();
             }
         }
     }
     else
     {
         Errors.Add(ZeroCodes.WRN_00_00);
     }
 }
 /// <summary>
 ///     Adds a range of validation rules.
 /// </summary>
 /// <param name="rule">Validation rules.</param>
 /// <returns>ValidatableObject.</returns>
 public ValidatableObject <T> AddRules(IEnumerable <IValidationRule <T> > rule)
 {
     Validations.AddRange(rule);
     return(this);
 }
예제 #3
0
 public InvalidParameterException(IEnumerable <string> validations)
     : base(Messages.InvalidParameterException)
 {
     Code = "00001";
     Validations.AddRange(validations);
 }
예제 #4
0
 public ValidationResult(IEnumerable <Validation> collection)
 {
     Validations.AddRange(collection);
 }