示例#1
0
        public async Task AddSync(Match match)
        {
            Match newMatch = new Match(match.MatchId, match.MatchDate);

            var player1 = await _context.Players.FindAsync(match.MatchPlayed.Player1Id);

            var player2 = await _context.Players.FindAsync(match.MatchPlayed.Player2Id);

            var winner = await _context.Players.FindAsync(match.MatchPlayed.WinnerId);

            await _context.Matches.AddAsync(newMatch);

            newMatch.MatchesPlayed.Add(new MatchPlayed(match, player1, player2, winner));

            await _context.SaveChangesAsync();
        }
        public async Task AddSync(Player player)
        {
            await _context.Players.AddAsync(player);

            await _context.SaveChangesAsync();
        }