public bool DeleteServer(Server server) { try { if (server.IpAddresses != null) { _serverContext.IpAddresses.RemoveRange(server.IpAddresses); } if (server.PublicSshKey != null) { _serverContext.PublicSshKeys.Remove(server.PublicSshKey); } if (server.HealthCheckProperties != null) { _serverContext.HealthCheckProperties.Remove(server.HealthCheckProperties); } _serverContext.Servers.Remove(server); _serverContext.SaveChanges(); return(true); } catch (Exception e) { _logger.Error(e); return(false); } }
public void AddCloudProvider(CloudProvider cloudProvider) { _serverContext.CloudProviders.Add(cloudProvider); _serverContext.SaveChanges(); }