public static bool Cadastro(ObjConexao objConexao) { bancoClienteDataContext = new BancoClienteDataContext(); conexao = new BancoDados.Conexao(); try { conexao.Ip = objConexao.Ip; conexao.Porta = objConexao.Porta; conexao.Senha = objConexao.Senha; conexao.Dominio = objConexao.Dominio; conexao.Id_Cliente = objConexao.ObjCliente.Id; conexao.Id_TipoConexao = objConexao.ObjTipoConexao.Id; bancoClienteDataContext.Conexaos.InsertOnSubmit(conexao); bancoClienteDataContext.SubmitChanges(); return(true); } catch (Exception) { throw; } finally { bancoClienteDataContext.Dispose(); } }
public static bool Cadastro(ObjConexao objConexao) { bancoClienteDataContext = new BancoClienteDataContext(); conexao = new BancoDados.Conexao(); try { conexao = bancoClienteDataContext.Conexaos.First(con => con.Id == objConexao.Id); bancoClienteDataContext.Conexaos.DeleteOnSubmit(conexao); bancoClienteDataContext.SubmitChanges(); return(true); } catch (Exception) { throw; } finally { bancoClienteDataContext.Dispose(); } }