public IEnumerable<ErrorMessage> Validate(ProducerDTO producer) { var entity = producer.To(); var validator = new ValidateProducer(entity.Name); var uniqueness = new UniquenessConstraint<Producer>(() => validator.Commit()); return validator.Errors.Union(uniqueness.Errors); }
public static ProducerDTO From(Producer producer) { var dto = new ProducerDTO(); dto.Name = producer.Name; return dto; }