Ejemplo n.º 1
0
        private async Task DeleteReplay()
        {
            await using var context = new DosDbContext();
            var replay = await context.Replay.FindAsync(replayId);

            if (replay != null)
            {
                context.Replay.Remove(replay);
                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 2
0
        private async Task FinishSavingReplay()
        {
            await using var context = new DosDbContext();
            var replay = await context.Replay.FindAsync(replayId);

            if (replay != null)
            {
                replay.IsOngoing = false;
                await context.SaveChangesAsync();
            }
        }
Ejemplo n.º 3
0
        public async Task UpdateGameConfigAsync(ulong serverId, BotGameConfig config)
        {
            await using var dbContext = new DosDbContext();
            var guildConfig = await GetGuildConfigAsync(dbContext, serverId);

            if (guildConfig == null)
            {
                guildConfig = new GuildConfig
                {
                    GuildId = serverId
                };
                await dbContext.AddAsync(guildConfig);
            }
            guildConfig.Config = config;
            await dbContext.SaveChangesAsync();
        }