public static bool Cadastrar(ObjModCli objModCli) { bancoClienteDataContext = new BancoClienteDataContext(); try { modCli = bancoClienteDataContext.ModClis.First(mcl => mcl.Id == objModCli.Id); bancoClienteDataContext.ModClis.DeleteOnSubmit(modCli); bancoClienteDataContext.SubmitChanges(); return(true); } catch (Exception) { throw; } finally { bancoClienteDataContext.Dispose(); } }
public static bool Cadastrar(ObjModCli objModCli) { bancoClienteDataContext = new BancoClienteDataContext(); modCli = new BancoDados.ModCli(); try { modCli.Id_Cliente = objModCli.ObjCliente.Id; modCli.Id_Modulo = objModCli.ObjModulo.Id; bancoClienteDataContext.ModClis.InsertOnSubmit(modCli); bancoClienteDataContext.SubmitChanges(); return(true); } catch (Exception) { throw; } finally { bancoClienteDataContext.Dispose(); } }