public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } _context.Attach(Holland).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HollandExists(Holland.ID)) { return(NotFound()); } else { throw; } } return(RedirectToPage("./Admin")); }
//The OnPostAsync method is run when the page posts form data public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); //he Page method creates a PageResult object that renders the Create.cshtml page. } _context.Holland.Add(Holland); //add video data await _context.SaveChangesAsync(); //save changes return(RedirectToPage("./Admin")); //after form submission return to index }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Holland = await _context.Holland.FindAsync(id); if (Holland != null) { _context.Holland.Remove(Holland); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }