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

            Post = await _context.Post
                   .Include(p => p.User).FirstOrDefaultAsync(m => m.PostId == id);

            if (Post == null)
            {
                return(NotFound());
            }
            ViewData["UserId"] = new SelectList(_context.Set <User>(), "Id", "Id");
            return(Page());
        }
示例#2
0
 public IActionResult OnGet()
 {
     ViewData["UserId"] = new SelectList(_context.Set <User>(), "Id", "Id");
     return(Page());
 }