public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Resource).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResourceExists(Resource.ResourceID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }