Example #1
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 #2
0
        public async Task SavePlayerExtendedAsync(PlayerExtended player)
        {
            // add only of the playerextended does not exist
            PlayerExtendedEntity entity = player.UserId == null ? null : await _context.PlayersExtended.FindAsync(player.Gamertag);

            if (entity == null)
            {
                await _context.PlayersExtended.AddAsync(new PlayerExtendedEntity
                {
                    UserId              = player.UserId,
                    Gamertag            = player.Gamertag,
                    ExtendedInformation = player.ExtendedInformation
                });

                await _context.SaveChangesAsync();
            }
            else
            {
                entity.Gamertag            = player.Gamertag;
                entity.ExtendedInformation = player.ExtendedInformation;
                await _context.SaveChangesAsync();
            }
        }
Example #3
0
        public async Task <PlayerExtended> GetPlayerDetailsExtendedAsync(string gamertag)
        {
            PlayerExtendedEntity player = await _context.PlayersExtended.SingleOrDefaultAsync(p => p.Gamertag.Equals(gamertag));

            return(player?.ToPlayerExtended());
        }
Example #4
0
        public async Task <string> GetPlayerStateByGamertagAsync(string gamertag)
        {
            PlayerExtendedEntity player = await _context.PlayersExtended.SingleOrDefaultAsync(p => p.Gamertag.Equals(gamertag));

            return(player?.State);
        }