Exemplo n.º 1
0
        public IEnumerable <TicketViewModel> GetTicketsByRoundId(int roundId)
        {
            var roundComb = _roundRepository.GetById(roundId).WinningComination;

            return(_ticketRepository.GetTicketsByRound(roundId).Select(t => new TicketViewModel
            {
                UserId = t.UserId,
                Combination = t.Combination,
                Status = t.Status,
                Round = t.Round,
                DateCreated = t.DateCreated,
                Prize = _calculateCombination.CalculatePrize(_calculateCombination
                                                             .GetNumberOfCorrectValues(t.Combination, roundComb))
            }));
        }
Exemplo n.º 2
0
        public async Task <Round> Handle(GetRoundById request, CancellationToken cancellationToken)
        {
            var round = await _repo.GetById(request.GameId, request.RoundId);

            if (round == null)
            {
                return(null);
            }

            return(new Round
            {
                Id = round.Id,
                GameId = request.GameId,
                RoundVersion = round.RoundVersion,
                StartedTimestamp = round.StartedTimestamp,
                EndedTimestamp = round.EndedTimestamp,
                Subject = round.Subject
            });
        }