public async Task <IActionResult> Edit(int id, [Bind("ID,Name,ReleaseDate,Genre,ageRestriction,Developer,lat,lng,Description,Path,Views")] Game game) { if (id != game.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(game); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GameExists(game.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(game)); }
public async Task <IActionResult> Edit(int id, [Bind("ID,GameID,Path,Title,Content,BriefContent,Likes")] Article article) { if (id != article.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(article); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArticleExists(article.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["GameID"] = new SelectList(_context.Gamedb, "ID", "Name", article.GameID); return(View(article)); }