我有一组可能属于或可能不属于某个组织的端点,组织中可能有多个或零个端点。我想从组织中删除特定端点。我写过这个方法,但我无法弄清楚它为什么不起作用:
public void DeleteEndpointFromOrganization(Guid id, int organiationId)
{
using (var db = new Context())
{
var organization = GetOrganizationById(organiationId);
var endpointSystem = organization.EndpointSystems.FirstOrDefault(e => e.Id == id);
if (endpointSystem != null)
{
organization.EndpointSystems.Remove(endpointSystem);
}
db.Organizations.AddOrUpdate(organization);
db.SaveChanges();
}
}