private void SavePlayers() { _context = new BBTrackerContext(); _context.Players.RemoveRange(_context.Players.Where(p => p.Nick != "PJDRN")); _context.Players.AddRange(Players); _context.SaveChanges(); }
public async Task <List <Play> > GetPlayerPlaysAsync(int playerId) { await using var _context = new BBTrackerContext(); return(await _context.Plays .Include(p => p.Game) .Where(p => p.Player.Id == playerId) .ToListAsync()); }
public async Task <List <Play> > GetPlaysFromGameAsync(int gameId) { await using var _context = new BBTrackerContext(); return(await _context.Plays .Include(p => p.Player) .Where(p => p.Game.Id == gameId) .ToListAsync()); }
//public event NotifyCollectionChangedEventHandler CollectionChanged; //public event PropertyChangedEventHandler PropertyChanged; public PlayerListViewModel() { _context = new BBTrackerContext(); Players = new ObservableCollection <Player> (_context.Players); AddOneCommand = new RelayCommand(AddOne); SavePlayersCommand = new RelayCommand(SavePlayers); }
public void OpenConnection() { _context = new BBTrackerContext(); }
public async Task <List <Game> > GetAllGamesAsync() { await using var _context = new BBTrackerContext(); return(await _context.Games.ToListAsync()); }
public UserRepo() { _context = new BBTrackerContext(); }
public void SaveChanges() { var _context = new BBTrackerContext(); }