public async Task ReceivingGameData(DecodedGameData decodedGameData) { var activeRound = await _gameRoundRepository.GetActive(); if (activeRound == null || !activeRound.Start.HasValue) { return; } var nowTime = DateTime.UtcNow; if ((activeRound.Pause.HasValue) || (activeRound.Start > nowTime) || (activeRound.End < nowTime)) { return; } var player = activeRound.Players.FirstOrDefault(p => p.PlayerId.Equals(decodedGameData.IdenCardId)); if (player == null) { return; } var encodedGameData = _gameDataMapper.Map(decodedGameData); await _gameDataRepository.Add(encodedGameData); }
public async Task <ArchivalGameRound <DecodedGameData> > Get(Guid id) { var round = await _archivalGameRoundRepository.Get(id); var decodedRound = new ArchivalGameRound <DecodedGameData> { Id = round.Id, Created = round.Created, Duration = round.Duration, Start = round.Start, End = round.Start, Name = round.Name, Players = round.Players }; decodedRound.GameData = round.GameData.Select(gd => _gameDataMapper.Map((EncodedGameData)gd)); return(decodedRound); }