public IHttpActionResult PutRanger_Vehicle(int id, Ranger_Vehicle ranger_Vehicle) { db.Configuration.ProxyCreationEnabled = false; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ranger_Vehicle.Vehicle_ID) { return(BadRequest()); } db.Entry(ranger_Vehicle).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Ranger_VehicleExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostRanger_Vehicle(Ranger_Vehicle ranger_Vehicle) { db.Configuration.ProxyCreationEnabled = false; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Ranger_Vehicle.Add(ranger_Vehicle); try { db.SaveChanges(); } catch (DbUpdateException) { if (Ranger_VehicleExists(ranger_Vehicle.Vehicle_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = ranger_Vehicle.Vehicle_ID }, ranger_Vehicle)); }
public IHttpActionResult GetRanger_Vehicle(int id) { db.Configuration.ProxyCreationEnabled = false; Ranger_Vehicle ranger_Vehicle = db.Ranger_Vehicle.Find(id); if (ranger_Vehicle == null) { return(NotFound()); } return(Ok(ranger_Vehicle)); }
public IHttpActionResult DeleteRanger_Vehicle(int id) { db.Configuration.ProxyCreationEnabled = false; Ranger_Vehicle ranger_Vehicle = db.Ranger_Vehicle.Find(id); if (ranger_Vehicle == null) { return(NotFound()); } db.Ranger_Vehicle.Remove(ranger_Vehicle); db.SaveChanges(); return(Ok(ranger_Vehicle)); }