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); }
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); }
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); }