public List<Book> GetBooks() { using (var db = new BooksContext()) { var books = (from entity in db.Books select entity).ToList(); return books; } }
public void AddBook(Book book) { using (var db = new BooksContext()) { db.Books.Add(book); db.SaveChanges(); } }