Example #1
0
 public static void addBook(Book book)
 {
     try
     {
         using (var db = new SE407_BookstoreContext())
         {
             db.Books.Add(book);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
     }
 }
Example #2
0
 public static void deleteBook(int id)
 {
     try
     {
         using (var db = new SE407_BookstoreContext())
         {
             var bookToDelete = db.Books.Find(id);
             db.Books.Remove(bookToDelete);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
     }
 }