public async Task Handle(CreateAuctionCommand message) { // Validation? how to validate busniess requirement of a unique auction name ? var auction = new Domain.Auction(new Guid(), message.Name, message.Items); await _auctionRepository.Add(auction); }
/// <inheritdoc /> protected override async Task HandleCore(CreateDistribution command) { Distribution distribution = new ( command.Name.Trim(), command.Owners, command.AvailableLifeCycles, command.LifeCycleStateRules ); foreach (ProjectBinding binding in command.ProjectBindings) { distribution.AddProjectBinding(binding, command.ActionUser.Sid); } distribution.AddBuildBindings(command.BuildBindings, command.ActionUser.Sid); await aggregateRepository.Add(distribution); }
/// <inheritdoc /> protected override async Task HandleCore(CreateBuild command) { logger.LogInformation($"Received command CreateBuild: {command}"); LifeCycleState lifeCycleState = lifeCycleStateMapper.MapFromSuffixes(command.Suffixes); logger.LogInformation($"Suffixes were mapped to {lifeCycleState}. {command}."); Build aggregate = new ( command.BuildDate, command.Number, command.ReleaseNumber, command.DistributionId, command.Location, command.SourceType, lifeCycleState, command.Suffixes); await aggregateRepository.Add(aggregate); logger.LogInformation($"Build aggregate Id:{aggregate.Id} has been created successfully. {command}"); }