public async Task <IActionResult> PutTeam([FromRoute] int id, [FromBody] Team team) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != team.TeamId) { return(BadRequest()); } _context.Entry(team).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TeamExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Put(int id, [FromBody] Team team) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Entry(team).State = Microsoft.EntityFrameworkCore.EntityState.Modified; db.SaveChanges(); return(AcceptedAtAction("Put", team)); }