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());
        }
Пример #2
0
        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());
        }
Пример #3
0
 public IActionResult OnGet()
 {
     ViewData["BookID"]     = new SelectList(_context.Book, "ID", "ID");
     ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "ID");
     return(Page());
 }