public async Task <IActionResult> Edit(int id, [Bind("ID,Title,AgeRating,ReleaseDate")] VideoGameListing videoGameListing) { if (id != videoGameListing.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(videoGameListing); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VideoGameListingExists(videoGameListing.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(videoGameListing)); }
public async Task <IActionResult> Create([Bind("ID,Title,AgeRating,ReleaseDate")] VideoGameListing videoGameListing) { if (ModelState.IsValid) { _context.Add(videoGameListing); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(videoGameListing)); }