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

            Content = await _context.Content
                      .Include(c => c.Category).FirstOrDefaultAsync(m => m.ID == id);

            if (Content == null)
            {
                return(NotFound());
            }
            return(Page());
        }
示例#2
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Content = await _context.Content.FindAsync(id);

            if (Content != null)
            {
                _context.Content.Remove(Content);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
示例#3
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Content = await _context.Content
                      .Include(c => c.Category).FirstOrDefaultAsync(m => m.ID == id);

            if (Content == null)
            {
                return(NotFound());
            }
            ViewData["CategoryID"] = new SelectList(_context.Category, "ID", "CategoryName");
            return(Page());
        }