public HttpResponseMessage Execute() { var responseMessage = _requestMessage.CreateResponse( HttpStatusCode.Created, _createdTask); responseMessage.Headers.Location = LocationLinkCalculator.GetLocationLink(_createdTask); return(responseMessage); }
public HttpResponseMessage Execute() { var acceptHeader = _requestMessage.Headers.Accept.FirstOrDefault(); var mediaType = acceptHeader == null ? null : acceptHeader.MediaType; var responseMessage = string.IsNullOrWhiteSpace(mediaType) ? _requestMessage.CreateResponse(HttpStatusCode.Created, _createdTask) : _requestMessage.CreateResponse(HttpStatusCode.Created, _createdTask, mediaType); responseMessage.Headers.Location = LocationLinkCalculator.GetLocationLink(_createdTask); return(responseMessage); }