public static void addBook(Book book) { try { using (var db = new SE407_BookstoreContext()) { db.Books.Add(book); db.SaveChanges(); } } catch (Exception e) { } }
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) { } }