public AccountParent DeleteAccountParent(long AccountParentID) { AccountParent dbEntry = context.AccountParent.Find(AccountParentID); if (dbEntry != null) { context.AccountParent.Remove(dbEntry); context.SaveChanges(); } return(dbEntry); }
public void SaveAccountParent(AccountParent AccountParent) { if (AccountParent.AccountParentId == 0) { context.AccountParent.Add(AccountParent); } else { AccountParent dbEntry = context.AccountParent.Find(AccountParent.AccountParentId); if (dbEntry != null) { dbEntry.AccountParentId = AccountParent.AccountParentId; dbEntry.AccountParentName = AccountParent.AccountParentName; } } context.SaveChanges(); }