public async Task Handle(CompetitorCreated message) { _repository.Add(new CompetitorDto() { Id = message.AggregateId, Name = message.Name }); _repository.Add(new CompetitorToFixtureMapDto { Id = message.AggregateId }); Console.WriteLine($"Handled fixture created event {message.AggregateId}:{message.Name}"); }
public Task Handle(SportCreated sport) { _repository.Add(new SportDto { Id = sport.AggregateId, Name = sport.Name }); _repository.Add(new SportToFixtureMapDto { Id = sport.AggregateId }); Console.WriteLine($"Handled sport created event {sport.AggregateId}:{sport.Name}"); return(Task.CompletedTask); }
public async Task Handle(FixtureCreated message) { var competitor1 = _repository.Get <CompetitorDto>(message.Competitor1); var competitor2 = _repository.Get <CompetitorDto>(message.Competitor2); var sport = _repository.Get <SportDto>(message.SportId); _repository.Add(new FixtureDto { Id = message.AggregateId, Title = message.Title, Sport = sport, Competitor1 = competitor1, Competitor2 = competitor2 }); Console.WriteLine($"Handled fixture created event {message.AggregateId}:{message.Title}"); }