示例#1
0
 public void AddBook(Book book)
 {
     using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext())
     {
         bookPortalDBContext.Books.ToList();
         bookPortalDBContext.Books.Add(book);
         bookPortalDBContext.SaveChanges();
     }
 }
示例#2
0
 public void Signup(Account account)
 {
     using (BookPortalDBContext accountContext = new BookPortalDBContext())
     {
         //accountContext.Accounts.ToList();
         accountContext.Accounts.Add(account);
         accountContext.SaveChanges();
     }
 }
示例#3
0
 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();
     }
 }