public void InsertOrUpdate(tGroup user) { if (user.IDGroup == default(int)) { // New entity context.tGroups.InsertOnSubmit(user); } else { // Existing entity tGroup userToUpdate = Find(user.IDGroup); if (userToUpdate != null && userToUpdate.IDGroup > 0) { userToUpdate.Name = user.Name; userToUpdate.IDGroup = user.IDGroup; } } context.SubmitChanges(); }
partial void DeletetGroup(tGroup instance);
partial void UpdatetGroup(tGroup instance);
partial void InserttGroup(tGroup instance);