public Book GetBookId(int bookId) { using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext()) { return(bookPortalDBContext.Books.Find(bookId)); } }
public IEnumerable <Book> GetBookDetails() { using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext()) { List <Book> books = bookPortalDBContext.Books.ToList(); return(books); } }
public void AddBook(Book book) { using (BookPortalDBContext bookPortalDBContext = new BookPortalDBContext()) { bookPortalDBContext.Books.ToList(); bookPortalDBContext.Books.Add(book); bookPortalDBContext.SaveChanges(); } }
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); } }
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(); } }