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