コード例 #1
0
 public void Update(Person person)
 {
     using (var context = new BirthdayListContext())
     {
         context.Entry(person).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
コード例 #2
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();
     }
 }