public HttpResponseMessage Put(Timesheet timesheet) { var response = Request.CreateResponse(HttpStatusCode.OK, timesheet); _repository.Save(timesheet); string uri = Url.Route(null, new { id = timesheet.Id }); // Where is the modified timesheet? response.Headers.Location = new Uri(Request.RequestUri, uri); return response; }
public HttpResponseMessage Post(Timesheet timesheet) { _repository.Insert(timesheet); string uri = Url.Route(null, new { id = timesheet.Id }); // Where is the new timesheet? var response = Request.CreateResponse(HttpStatusCode.Created, timesheet); response.Headers.Location = new Uri(Request.RequestUri, uri); return response; }