public void AddBook(Book book) { using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext()) { bookPortalDBContext.Books.ToList(); bookPortalDBContext.Books.Add(book); bookPortalDBContext.SaveChanges(); } }
public void Signup(Account account) { using (BookPortalDBContext accountContext = new BookPortalDBContext()) { //accountContext.Accounts.ToList(); accountContext.Accounts.Add(account); accountContext.SaveChanges(); } }
public void DeleteBook(int bookId) { using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext()) { Book book = bookPortalDBContext.Books.Find(bookId); if (book != null) { bookPortalDBContext.Books.Remove(book); } bookPortalDBContext.SaveChanges(); } }