예제 #1
0
        public async Task <int> CompareResultsAsync(GameDto game, PredictionDto prediction)
        {
            var gameEntity       = game.ToEntity();
            var predictionEntity = prediction.ToEntity();
            var test             = await _predictionRepository.CompareResultsAsync(gameEntity, predictionEntity);

            return(test);
        }
예제 #2
0
        public async Task UpdatePredictionAsync(int gameId, Guid?userId, string prediction)
        {
            PredictionDto predictionDto = new PredictionDto()
            {
                GameId          = gameId,
                UserId          = userId,
                PredictedResult = prediction
            };

            var predictionEntity = predictionDto.ToEntity();

            await _predictionRepository.UpdatePredictionAsync(predictionEntity);
        }
예제 #3
0
        public async Task AddPointsAsync(Guid?userId, int gameId, int points)
        {
            var prediction = await _predictionRepository.GetPredictionAsync(gameId, userId);

            if (prediction != null)
            {
                prediction.EarnedPoints = points;
            }
            else
            {
                PredictionDto predictionDto = new PredictionDto()
                {
                    GameId       = gameId,
                    UserId       = userId,
                    EarnedPoints = points
                };

                prediction = predictionDto.ToEntity();
            }

            await _predictionRepository.AddPointsAsync(prediction);
        }