Ejemplo n.º 1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            NovelAuthor = await _context.NovelAuthor
                          .Include(n => n.Authors)
                          .Include(n => n.Novels).FirstOrDefaultAsync(m => m.NovelAuthorId == id);

            if (NovelAuthor == null)
            {
                return(NotFound());
            }
            ViewData["AuthorId"] = new SelectList(_context.Author, "AuthorId", "AuthorId");
            ViewData["NovelId"]  = new SelectList(_context.Set <Novel>(), "NovelId", "NovelId");
            return(Page());
        }
Ejemplo n.º 2
0
 public IActionResult OnGet()
 {
     ViewData["AuthorId"] = new SelectList(_context.Author, "AuthorId", "AuthorId");
     ViewData["NovelId"]  = new SelectList(_context.Set <Novel>(), "NovelId", "NovelId");
     return(Page());
 }