public async Task <IActionResult> PutPlayer(int id, Player player) { if (id != player.Id) { return(BadRequest()); } _context.Entry(player).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,Name,Birth,Country,Rating")] Player player) { if (ModelState.IsValid) { db.Entry(player).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(player)); }
public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Email")] Player player) { if (ModelState.IsValid) { db.Entry(player).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(PartialView("Edit", player)); }
public ActionResult Edit([Bind(Include = "PlayerID,FirstName,LastName,Age,SkillLevel,EmailAddress")] Player player) { if (ModelState.IsValid) { db.Entry(player).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(player)); }
public JsonResult UpdatePlayer(Player player) { context.Entry(player).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return(Json(new { status = "Player updated successfully" })); }