public IHttpActionResult PutGroundControlSystem(int id, GroundControlSystem groundControlSystem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != groundControlSystem.id) { return(BadRequest()); } db.Entry(groundControlSystem).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GroundControlSystemExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetGroundControlSystem(int id) { GroundControlSystem groundControlSystem = db.GroundControlSystems.Find(id); if (groundControlSystem == null) { return(NotFound()); } return(Ok(groundControlSystem)); }
public IHttpActionResult PostGroundControlSystem(GroundControlSystem groundControlSystem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.GroundControlSystems.Add(groundControlSystem); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = groundControlSystem.id }, groundControlSystem)); }
public IHttpActionResult DeleteGroundControlSystem(int id) { GroundControlSystem groundControlSystem = db.GroundControlSystems.Find(id); if (groundControlSystem == null) { return(NotFound()); } db.GroundControlSystems.Remove(groundControlSystem); db.SaveChanges(); return(Ok(groundControlSystem)); }