// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(RedirectLink).State = EntityState.Modified; try { await _context.SaveChangesAsync(); _seedService.SeedRedirects(); } catch (DbUpdateConcurrencyException) { if (!RedirectExists(RedirectLink.RedirectId)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } RedirectLink = await _context.Redirects.FindAsync(id); if (RedirectLink != null) { _context.Redirects.Remove(RedirectLink); await _context.SaveChangesAsync(); _seedService.SeedRedirects(); } return(RedirectToPage("./Index")); }