Beispiel #1
0
 // GET api/<controller>
 public async Task <string> Get()
 {
     using (var db = await _connFactory.OpenDbConnectionAsync())
     {
         db.CreateTableIfNotExists <Tournament>();
         db.CreateTableIfNotExists <Match>();
     }
     return("OK");
 }
        public async Task <Match> AddMatchAsync(Match match)
        {
            using (var db = await _connFactory.OpenDbConnectionAsync())
            {
                await db.SaveAsync(match);

                return(match);
            }
        }
        public async Task <Tournament> AddTournamentAsync(Tournament tournament)
        {
            using (var db = await _connFactory.OpenDbConnectionAsync())
            {
                await db.SaveAsync(tournament, references : tournament.Matches != null);

                return(tournament);
            }
        }