public IHttpActionResult PutPartyVehicle(long id, PartyVehicle partyVehicle) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != partyVehicle.ID) { return(BadRequest()); } db.Entry(partyVehicle).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PartyVehicleExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPartyVehicle(long id) { PartyVehicle partyVehicle = db.PartyVehicles.Find(id); if (partyVehicle == null) { return(NotFound()); } return(Ok(partyVehicle)); }
public IHttpActionResult PostPartyVehicle(PartyVehicle partyVehicle) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PartyVehicles.Add(partyVehicle); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = partyVehicle.ID }, partyVehicle)); }
public IHttpActionResult DeletePartyVehicle(long id) { PartyVehicle partyVehicle = db.PartyVehicles.Find(id); if (partyVehicle == null) { return(NotFound()); } db.PartyVehicles.Remove(partyVehicle); db.SaveChanges(); return(Ok(partyVehicle)); }