public async Task <Unit> Handle(ShowCard request, CancellationToken cancellationToken)
        {
            await ValidateGame(request.GameId);

            var isSuccesful = await gameRepository.AddCard(new Persistence.Entities.Card()
            {
                GameId = request.GameId, PlayerNumber = request.PlayerNumber, Team = request.Team
            });

            if (!isSuccesful)
            {
                throw new Exception($"Card with gameid :{request.GameId} couldnt be added");
            }

            await this.eventBus.Publish(new RefereeHasShowedCard(request.GameId, request.Team, request.PlayerNumber));

            return(Unit.Value);
        }
Exemplo n.º 2
0
 public Player AddCard(Guid guid)
 {
     return(gameRepository.AddCard(guid));
 }