Beispiel #1
0
 public IActionResult OnGet()
 {
     ViewData["AuthorId"]   = new SelectList(_context.Set <User>(), "Id", "Id");
     ViewData["DesignerId"] = new SelectList(_context.Set <User>(), "Id", "Id");
     ViewData["EditorId"]   = new SelectList(_context.Set <User>(), "Id", "Id");
     return(Page());
 }
Beispiel #2
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Article = await _context.Articles
                      .Include(a => a.Author)
                      .Include(a => a.Designer)
                      .Include(a => a.Editor).FirstOrDefaultAsync(m => m.Id == id);

            if (Article == null)
            {
                return(NotFound());
            }
            ViewData["AuthorId"]   = new SelectList(_context.Set <User>(), "Id", "Id");
            ViewData["DesignerId"] = new SelectList(_context.Set <User>(), "Id", "Id");
            ViewData["EditorId"]   = new SelectList(_context.Set <User>(), "Id", "Id");
            return(Page());
        }