public void inserirConta(Conta c) { DataContext dc = getDataContext(); Table<Conta> tc = dc.GetTable<Conta>(); tc.InsertOnSubmit(c); dc.SubmitChanges(); }
public void alterarConta(Conta c) { DataContext dc = getDataContext(); Table<Conta> tc = dc.GetTable<Conta>(); tc.Attach(c, true); try { dc.SubmitChanges(ConflictMode.ContinueOnConflict); } //catch (ChangeConflictException e) catch (ChangeConflictException) { dc.ChangeConflicts.ResolveAll(RefreshMode.KeepCurrentValues); // last -in - wins dc.SubmitChanges(); } }