public async Task <IActionResult> PutRoster(int id, Roster roster) { if (id != roster.PMId) { return(BadRequest()); } _context.Entry(roster).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RosterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,Name,City")] Team team) { if (ModelState.IsValid) { db.Entry(team).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(team)); }
public ActionResult Edit([Bind(Include = "ID,LastName,FirstName,Age,PlayerNumber,TeamID,Position,Hits")] Player player) { if (ModelState.IsValid) { db.Entry(player).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.TeamID = new SelectList(db.Teams, "ID", "Name", player.TeamID); return(View(player)); }