public ActionResult Edit([Bind(Include = "teamID,teamName")] Team team) { if (ModelState.IsValid) { db.Entry(team).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(team)); }
public ActionResult Edit([Bind(Include = "positionCode,positionDescription")] Position position) { if (ModelState.IsValid) { db.Entry(position).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(position)); }
public ActionResult Edit([Bind(Include = "playerID,playerLastName,playerFirstName,positionCode,teamID")] Player player) { if (ModelState.IsValid) { db.Entry(player).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.positionCode = new SelectList(db.Positions, "positionCode", "positionDescription", player.positionCode); ViewBag.teamID = new SelectList(db.Teams, "teamID", "teamName", player.teamID); return(View(player)); }
public async Task <ActionResult <Team> > Put(int id, Team team) { if (id != team.TeamId) { return(BadRequest()); } _db.Entry(team).State = EntityState.Modified; try { await _db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Player> > Put(int id, Player player) { if (id != player.PlayerId) { return(BadRequest()); } _db.Entry(player).State = EntityState.Modified; try { await _db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlayerExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }