예제 #1
0
 public Book Save(Book book)
 {
     if (book.Id == 0)
         context.Books.Add(book);
     else
         context.Entry(book).State = System.Data.Entity.EntityState.Modified;
     context.SaveChanges();
     return book;
 }
예제 #2
0
 public void Delete(Book book)
 {
     context.Books.Remove(book);
     context.SaveChanges();
 }