public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Book = await _context.Book.FirstOrDefaultAsync(m => m.ID == id); if (Book == null) { return(NotFound()); } ViewData["PublisherID"] = new SelectList(_context.Set <Publisher>(), "ID", "PublisherName"); return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } BookCategory = await _context.BookCategory .Include(b => b.Book) .Include(b => b.Category).FirstOrDefaultAsync(m => m.ID == id); if (BookCategory == null) { return(NotFound()); } ViewData["BookID"] = new SelectList(_context.Book, "ID", "ID"); ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "ID"); return(Page()); }
public IActionResult OnGet() { ViewData["BookID"] = new SelectList(_context.Book, "ID", "ID"); ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "ID"); return(Page()); }