Example #1
0
 private void SavePlayers()
 {
     _context = new BBTrackerContext();
     _context.Players.RemoveRange(_context.Players.Where(p => p.Nick != "PJDRN"));
     _context.Players.AddRange(Players);
     _context.SaveChanges();
 }
Example #2
0
 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());
 }
Example #3
0
 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());
 }
Example #4
0
        //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);
        }
Example #5
0
 public void OpenConnection()
 {
     _context = new BBTrackerContext();
 }
Example #6
0
 public async Task <List <Game> > GetAllGamesAsync()
 {
     await using var _context = new BBTrackerContext();
     return(await _context.Games.ToListAsync());
 }
Example #7
0
 public UserRepo()
 {
     _context = new BBTrackerContext();
 }
Example #8
0
 public void SaveChanges()
 {
     var _context = new BBTrackerContext();
 }