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