public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Publicare = await _context.Publicare.FirstOrDefaultAsync(m => m.ID == id); if (Publicare == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Publicare = await _context.Publicare.FirstOrDefaultAsync(m => m.ID == id); if (Publicare == null) { return(NotFound()); } ViewData["PublicareID"] = new SelectList(_context.Set <Publicare>(), "ID", "NumelePublicarii"); return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Publicare = await _context.Publicare.FindAsync(id); if (Publicare != null) { _context.Publicare.Remove(Publicare); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }