public HttpResponseMessage Post([FromBody] orders obj) { orders orders = new orders(); string outMessage = string.Empty; if (orders.Create(obj, out outMessage)) { obj.id = outMessage; var message = Request.CreateResponse(HttpStatusCode.Created, obj); message.Headers.Location = new Uri(Request.RequestUri + obj.id); return(message); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, outMessage)); } }