public void InsertOrUpdate(CHATMESSAGE rate) { if (rate.MESSAGEID == default(int)) // New entity { _context.Entry(rate).State = EntityState.Added; } else // Existing entity { _context.Entry(rate).State = EntityState.Modified; } }
public void InsertOrUpdateGraph(CHATMESSAGE userGraph) { if (userGraph.State == DOCVIDEO.ObjectState.State.Added) { _context.ChatMessages.Add(userGraph); } else { _context.ChatMessages.Add(userGraph); _context.ApplyStateChanges(); } }