public override IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (ModelDefinitionId.HasValue && !ModelName.IsNullOrWhiteSpace()) { yield return(new ValidationResult( "ModelDefinitionId and ModelName cannot have values at the same time.", new[] { nameof(ModelDefinitionId), nameof(ModelName) })); } if (!ModelDefinitionId.HasValue && ModelName.IsNullOrWhiteSpace()) { yield return(new ValidationResult("ModelDefinitionId and ModelName cannot both be empty.", new[] { nameof(ModelDefinitionId), nameof(ModelName) })); } }
public override String ToString() { var builder = new StringBuilder(); builder.AppendFormat("Brand: '{0}'", BrandName); if (!ModelName.IsNullOrWhiteSpace()) { builder.AppendFormat(" | Model: '{0}'", ModelName); } if (!GroupCode.IsNullOrWhiteSpace()) { builder.AppendFormat(" | Group: {0}", GroupCode); } builder.AppendFormat(" | From: {0} => {1}", From, To); return(builder.ToString()); }