public void Update(Person person) { using (var context = new BirthdayListContext()) { context.Entry(person).State = EntityState.Modified; context.SaveChanges(); } }
public void Add(Person person) { using (var context = new BirthdayListContext()) { context.People.Add(person); context.SaveChanges(); } }
public void Remove(int id) { using (var context = new BirthdayListContext()) { var person = new Person { Id = id }; context.Entry(person).State = EntityState.Deleted; context.SaveChanges(); } }