public GeneralResponse DeleteNetwork(DeleteRequest request) { GeneralResponse response = new GeneralResponse(); Network network = new Network(); network = _networkRepository.FindBy(request.ID); if (network != null) { try { _networkRepository.Remove(network); _uow.Commit(); ////response.success = true; } catch (Exception ex) { response.ErrorMessages.Add(ex.Message); } } return(response); }
public void Remove(Network network) { //TODO: improve this method _networks.Remove(network); foreach (var guest in _guests.Get(network)) { _guests.Remove(network, guest); } }
public Response Delete(int id) { var cache = new InMemoryRepositoryModelCache(); var network = _networkRepository.Get(_user, id, cache); if (network == null) { return(RpcNetworkRepositoryHelpers.CreateNotFoundError()); } var deviceRepository = _repositoryFactory.GetDeviceRepository(); foreach (var device in deviceRepository.Get(network, cache)) { deviceRepository.Remove(device); } _networkRepository.Remove(network); return(Response.Empty()); }