コード例 #1
0
        public async Task <GuildSettings> GetSettingsAsync(ulong guildID)
        {
            GuildSettings settings = await GuildConfigs.FirstOrDefaultAsync(x => x.GuildID == guildID).ConfigureAwait(false);

            if (settings != null)
            {
                return(settings);
            }

            GuildConfigs.Add(settings = new GuildSettings()
            {
                GuildID = guildID
            });
            await SaveChangesAsync().ConfigureAwait(false);

            return(settings);
        }
コード例 #2
0
 public async Task UpdateSettings(GuildSettings guildSettings)
 {
     GuildConfigs.Update(guildSettings);
     await SaveChangesAsync().ConfigureAwait(false);
 }