public async Task Update(DynamicRoleIgnore value) { //try //{ // var entry = Context.Attach(value); // entry.State = EntityState.Modified; //} //catch //{ // //ignore //} Context.IgnoredUsers.Update(value); await Context.SaveChangesAsync(); }
/// <summary> /// Register a user to ignore role automation. /// </summary> /// <param name="serverId">The id of the server.</param> /// <param name="userId">The id of the user.</param> /// <exception cref="RoleIgnoreExistsException">Thrown if the user is already registered.</exception> public async Task AddRoleIgnore(ulong serverId, ulong userId) { var ignore = await _dbIgnore.Get(serverId, userId); if (ignore != null) { throw new RoleIgnoreExistsException("The generated role already exists in the database."); } ignore = new DynamicRoleIgnore { ServerId = serverId, UserId = userId }; await _dbIgnore.Add(ignore); }
public async Task Add(DynamicRoleIgnore value) { Context.IgnoredUsers.Add(value); await Context.SaveChangesAsync(); }