public async Task Add(Concept concept, CancellationToken cancellationToken = default(CancellationToken)) { var existing = await _conceptRepository.GetByName(concept.Name, cancellationToken); if (existing != null) { throw new DomainValidationException($"A concept named {concept.Name} already exists."); } await _conceptRepository.Create(concept, cancellationToken); }
protected override async Task HandleTransacted(AddConceptCommand command, CancellationToken cancellationToken = default(CancellationToken)) { var concept = new Concept(command.ConceptId, command.DomainId, command.Name, command.Description); await _conceptRepository.Create(concept, cancellationToken); }