public async Task <int> AddAsyncPlayer(Player player, int userId)
        {
            _context.Players.Add(player);
            _context.SaveChanges();
            await Task.CompletedTask;   //to musi byc w asynchronicznych bo by zwracal warningi.
            int playerId = player.Id;

            return(playerId);
        }
        public async Task <int> AddAsyncMatch(Matchh match, int userId)  // metoda dodaje mecz do bazy
        {
            _context.Matches.Add(match);
            _context.SaveChanges();
            await Task.CompletedTask;

            //zwraca matchId utworzonego meczu
            int matchId = match.Id;

            return(await Task.FromResult(matchId));
        }
        public async Task DeleteAsyncUserAccount(User user)
        {
            var           matches    = _context.Matches.Where(x => x.UserId == user.Id);
            List <Matchh> listameczy = matches.ToList();

            foreach (Matchh elem in listameczy)
            {
                _context.Matches.Remove(elem);
                _context.SaveChanges();
            }
            var           players         = _context.Players.Where(x => x.UserId == user.Id);
            List <Player> listazawodnikow = players.ToList();

            foreach (Player elem in listazawodnikow)
            {
                _context.Players.Remove(elem);
                _context.SaveChanges();
            }
            _context.Users.Remove(user);
            _context.SaveChanges();
            await Task.CompletedTask;
        }