public void InsertOrUpdate(CompetencyHeader competencyHeader) { if (competencyHeader.CompetencyHeaderId == 0) //new { context.CompetencyHeaders.Add(competencyHeader); } else //edit { context.Entry(competencyHeader).State = EntityState.Modified; } }
public void InsertOrUpdate(CompetencyHeader competencyHeader) { if (competencyHeader.CompetencyHeaderId == 0) { db.CompetencyHeaders.Add(competencyHeader); } else { db.Entry(competencyHeader).State = EntityState.Modified; } Save(); }