public void InsertOrUpdate(DOCTORNOTES cap) { if (cap.DOCTORNOTESID == default(int)) // New entity { _context.Entry(cap).State = EntityState.Added; } else // Existing entity { _context.Entry(cap).State = EntityState.Modified; } }
public void InsertOrUpdateGraph(DOCTORNOTES workGraph) { if (workGraph.State == DOCVIDEO.ObjectState.State.Added) { _context.DoctorNotes.Add(workGraph); } else { _context.DoctorNotes.Add(workGraph); _context.ApplyStateChanges(); } }