public async Task LastMatch() { var discordUser = Context.User; using (var context = new BotDBContext()) { var user = await context.Users.FirstOrDefaultAsync(u => u.DiscordId == discordUser.Id); if (user != null) { var usersPlayers = await context.UsersPlayers.Where(u => u.UserID == user.ID).Include(p => p.Players).FirstOrDefaultAsync(); if (usersPlayers != null) { StringBuilder builder = new StringBuilder(); builder.AppendLine(Strings.YourPlayers); foreach (var player in usersPlayers.Players) { using (var con = new PubgDB()) { var playerInDB = await con.Players.FirstOrDefaultAsync(p => p.Id == player.PubgID); builder.AppendLine(playerInDB.Name); } } await ReplyAsync(builder.ToString()); } else { await ReplyAsync(Strings.NoWatchFound); } } else { await ReplyAsync(Strings.NoWatchFound); } } }
public PlayerRepository() { PubgDB = new PubgDB(); playerService = new PubgPlayerService(); }
public PlayerRepository(Player player) { playerService = new PubgPlayerService(); PubgDB = new PubgDB(); Player = player; }
public PubgModule() { pubgDB = new PubgDB(); botDB = new BotDBContext(); }