public async Task <IActionResult> Update(VideoGame g) { if (ModelState.IsValid) { await VideoGameDB.UpdateGame(g, _context); return(RedirectToAction("Index")); } //If there are any errors, show the user //the form again return(View(g)); }
[HttpPost] //After they fill out the form and submit it public async Task <IActionResult> Update(VideoGame g) { if (ModelState.IsValid) { await VideoGameDB.UpdateGame(g, context); return(RedirectToAction("Index")); //Sends the user back to the video game index page } //If there are any errors, show the user the form again return(View(g)); }