public async Task <IActionResult> PutGame([FromRoute] int id, [FromBody] Game game) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != game.Id) { return(BadRequest()); } _context.Entry(game).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GameExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "Id,GameTitle,Publisher,ReleaseDate,Platform,Genre,Description,InStockAmount,Price")] Game game) { if (ModelState.IsValid) { db.Entry(game).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(game)); }