示例#1
0
 public Book GetBookId(int bookId)
 {
     using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext())
     {
         return(bookPortalDBContext.Books.Find(bookId));
     }
 }
示例#2
0
 public IEnumerable <Book> GetBookDetails()
 {
     using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext())
     {
         List <Book> books = bookPortalDBContext.Books.ToList();
         return(books);
     }
 }
示例#3
0
 public void AddBook(Book book)
 {
     using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext())
     {
         bookPortalDBContext.Books.ToList();
         bookPortalDBContext.Books.Add(book);
         bookPortalDBContext.SaveChanges();
     }
 }
示例#4
0
        public Account Login(Account account)
        {
            using (BookPortalDBContext accountContext = new BookPortalDBContext())
            {
                Account result = accountContext.Accounts.Where(temp => temp.MailId == account.MailId && temp.MailId == account.MailId).FirstOrDefault();

                return(result);
            }
        }
示例#5
0
 public void Signup(Account account)
 {
     using (BookPortalDBContext accountContext = new BookPortalDBContext())
     {
         //accountContext.Accounts.ToList();
         accountContext.Accounts.Add(account);
         accountContext.SaveChanges();
     }
 }
示例#6
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();
     }
 }