コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: GameDataMapper.cs プロジェクト: biouex/bonus-racing
 public EncodedGameData Map(DecodedGameData decodedGameData)
 {
     return(new EncodedGameData
     {
         Id = decodedGameData.Id,
         ReceivingDate = decodedGameData.ReceivingDate,
         SessionId = decodedGameData.SessionId,
         CardNumber = decodedGameData.CardNumber,
         PlayerId = decodedGameData.PlayerId,
         FirstName = _cryptoServiceProvider.Encrypt(decodedGameData.FirstName),
         LastName = _cryptoServiceProvider.Encrypt(decodedGameData.LastName),
         MiddleName = _cryptoServiceProvider.Encrypt(decodedGameData.MiddleName),
         IdenCardId = decodedGameData.IdenCardId,
         MachId = decodedGameData.MachId,
         UpdateDate = decodedGameData.UpdateDate,
         EarnedPoints = decodedGameData.EarnedPoints
     });
 }