public void Add(Person person) { using (var context = new CIProjectContext()) { var dbSet = context.Set <Person>(); dbSet.Add(person); context.SaveChanges(); } }
public void Update(Person person) { using (var context = new CIProjectContext()) { var dbSet = context.Set <Person>(); dbSet.Attach(person); context.Entry(person).State = EntityState.Modified; context.SaveChanges(); } }