示例#1
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Article = await _context.Articles
                      .Include(a => a.Category)
                      .Include(a => a.User).FirstOrDefaultAsync(m => m.ID == id);

            if (Article == null)
            {
                return(NotFound());
            }
            ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "Title");
            ViewData["UserID"]     = new SelectList(_context.Set <User>(), "ID", "Login");
            return(Page());
        }
示例#2
0
 public IActionResult OnGet()
 {
     ViewData["CategoryID"] = new SelectList(_context.Set <Category>(), "ID", "Title");
     ViewData["UserID"]     = new SelectList(_context.Set <User>(), "ID", "Login");
     return(Page());
 }