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(); } }
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(); } }
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(); }