Example #1
0
        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");
            ViewData["BookCategories"] = new SelectList(_context.Set <Category>(), "CategoryID", "BookTitle");
            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());
        }
Example #3
0
 public IActionResult OnGet()
 {
     ViewData["BookID"]     = new SelectList(_context.Book, "ID", "ID");
     ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "ID");
     return(Page());
 }
 public IActionResult OnGet()
 {
     ViewData["PublisherID"]    = new SelectList(_context.Set <Publisher>(), "ID", "PublisherName");
     ViewData["BookCategories"] = new SelectList(_context.Set <BookCategory>(), "CategoryID", "BookTitle");
     return(Page());
 }