Beispiel #1
0
 public void Handle(PlayGameCommand command)
 {
     using (var session = _sessionFactory.OpenSession())
     {
         var competition = CompetitionRepository.GetOrCreate(_eventBus);
         competition.PlayGame(command.RedOffensive, command.RedDefensive, command.BlueOffensive, command.BlueDefensive, command.ScoreRed, command.ScoreBlue);
         session.SubmitChanges();
     }
 }
Beispiel #2
0
 public void Handle(RegisterPlayarCommand command)
 {
     using (var session = _sessionFactory.OpenSession())
     {
         var repository  = new PlayarRepository(_eventBus);
         var competition = CompetitionRepository.GetOrCreate(_eventBus);
         var id          = Guid.NewGuid();
         repository.Add(new Playar(id, command.Name));
         competition.AddPlayer(id);
         session.SubmitChanges();
     }
 }