private async Task <bool> RemoveGuildBinding(IGuild guild) { using (var db = new BadWordContext(dbOptions)) { var bindings = await db.BadWordServerBindings.Where(b => b.ServerId == guild.Id).ToListAsync(); if (!bindings.Any()) { return(false); } foreach (var guildBinding in bindings) { db.Remove(guildBinding); } await db.SaveChangesAsync(); return(true); } }
private async Task <bool> RemoveChannelBinding(ITextChannel channel) { using (var db = new BadWordContext(dbOptions)) { var bindings = await db.BadWordChannelBindings.Where(b => b.ChannelId == channel.Id).ToListAsync(); if (!bindings.Any()) { return(false); } foreach (var channelBinding in bindings) { db.Remove(channelBinding); } await db.SaveChangesAsync(); return(true); } }