public async Task<IHttpActionResult> PutTeam(long id, Team team) { if (!ModelState.IsValid) { return BadRequest(ModelState); } 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 StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostTeam(Team team) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Teams.Add(team); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = team.TeamID }, team); }