public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } DoNotContactLetter = await _context.DoNotContactLetters .Include(d => d.Publisher) .Include(d => d.Territory).FirstOrDefaultAsync(m => m.DoNotContactLetterId == id); if (DoNotContactLetter == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } DoNotContactLetter = await _context.DoNotContactLetters.FindAsync(id); if (DoNotContactLetter != null) { _context.DoNotContactLetters.Remove(DoNotContactLetter); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }