public async Task <Unit> Handle(UpdateBetCommand request, CancellationToken cancellationToken)
        {
            var bet = await _betRepository.GetByIdAsync(new BetId(request.BetId))
                      ?? throw new BetUnknownException($"This bet with Id {request.BetId} does not exist");

            var dto = new BetDto(bet.State);
            await _betQueryRepository.SaveAsync(dto);

            return(Unit.Value);
        }
Exemplo n.º 2
0
        public async Task Handle(InsertBetQuerySideNotification request, CancellationToken cancellationToken)
        {
            ValidateRequest(request);

            var bet = await _betRepository.GetByIdAsync(new BetId(request.BetId)).ConfigureAwait(false)
                      ?? throw new BetUnknownException($"BetId: {request.BetId} is unknwon");

            var betDto = new BetDto(bet.State);
            await _queryBetRepository.SaveAsync(betDto);
        }