// POST api/camera public HttpResponseMessage Post(Camera camera) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } camera = _repository.Create(camera); var url = Url.Link("DefaultApi", new {controller = "cameras", id = camera.Id}); var response = Request.CreateResponse(HttpStatusCode.Created, camera); response.Headers.Location = new Uri(url); return response; }
// PUT api/camera/5 public void Put(int id, Camera camera) { Request.CreateErrorResponse(HttpStatusCode.NotImplemented, String.Empty); }