using NadekoBot.Services.Database.Models; using Microsoft.EntityFrameworkCore; namespace NadekoBot.Db; public static class SelfAssignableRolesExtensions { public static bool DeleteByGuildAndRoleId(this DbSet roles, ulong guildId, ulong roleId) { var role = roles.FirstOrDefault(s => s.GuildId == guildId && s.RoleId == roleId); if (role is null) return false; roles.Remove(role); return true; } public static IEnumerable GetFromGuild(this DbSet roles, ulong guildId) => roles.AsQueryable() .Where(s => s.GuildId == guildId) .ToArray(); }