public async Task SavePlayerStateByUserIdAsync(string userId, string state)
        {
            // add only of the playerextended does not exist
            PlayerExtendedEntity entity = await _context.PlayersExtended.FindAsync(userId);

            if (entity == null)
            {
                entity = new PlayerExtendedEntity();
                _context.PlayersExtended.Add(entity);
            }
            entity.UserId = userId;
            entity.State  = state;
            await _context.SaveChangesAsync();
        }
Example #2
0
        public async Task SavePlayerStateByGamertagAsync(string gamertag, string state)
        {
            // add only of the playerextended does not exist
            PlayerExtendedEntity entity = await _context.PlayersExtended.FindAsync(gamertag);

            if (entity == null)
            {
                entity = new PlayerExtendedEntity();
                _context.PlayersExtended.Add(entity);
            }
            entity.Gamertag = gamertag;
            entity.State    = state;
            await _context.SaveChangesAsync();
        }
Example #3
0
        public async Task <string> GetPlayerStateByGamertagAsync(string gamertag)
        {
            PlayerExtendedEntity player = await _context.PlayersExtended.SingleOrDefaultAsync(p => p.Gamertag.Equals(gamertag));

            return(player?.State);
        }
        public async Task <string> GetPlayerStateByUserIdAsync(string userId)
        {
            PlayerExtendedEntity player = await _context.PlayersExtended.SingleOrDefaultAsync(p => p.UserId.Equals(userId));

            return(player?.State);
        }