public IHttpActionResult PutTeamStatType(int id, TeamStatType teamStatType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != teamStatType.Id) { return(BadRequest()); } db.Entry(teamStatType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TeamStatTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTeamStatType(int id) { TeamStatType teamStatType = db.TeamStatTypes.Find(id); if (teamStatType == null) { return(NotFound()); } return(Ok(teamStatType)); }
public IHttpActionResult PostTeamStatType(TeamStatType teamStatType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TeamStatTypes.Add(teamStatType); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = teamStatType.Id }, teamStatType)); }
public IHttpActionResult DeleteTeamStatType(int id) { TeamStatType teamStatType = db.TeamStatTypes.Find(id); if (teamStatType == null) { return(NotFound()); } db.TeamStatTypes.Remove(teamStatType); db.SaveChanges(); return(Ok(teamStatType)); }