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