// DELETE /api/cars/{id} public HttpResponseMessage DeleteCar(int id) { if (!_carsCtx.TryRemove(id)) { var response = Request.CreateResponse(HttpStatusCode.NotFound); throw new HttpResponseException(response); } return Request.CreateResponse(HttpStatusCode.OK); }
public HttpResponseMessage Delete(int id) { if (!_carsContext.TryRemove(id)) { var response = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Contact not found") }; throw new HttpResponseException(response); } return(new HttpResponseMessage(HttpStatusCode.OK)); }