public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(SpecSelResult).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { //if (!SpecSelResultExists(SpecSelResult.ID)) if (!_context.SpecSelResult.Any(e => e.ID == SpecSelResult.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Index")); }
/// <summary> /// The OnPostAsync method is run when the page posts form data. /// If there are any model errors, the form is redisplayed, along with any form data posted. /// </summary> /// <returns></returns> public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.SpecSelResult.Add(SpecSelResult); await _context.SaveChangesAsync(); return(RedirectToPage("./Index")); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } SpecSelResult = await _context.SpecSelResult.FindAsync(id); if (SpecSelResult != null) { _context.SpecSelResult.Remove(SpecSelResult); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }