public HttpResponseMessage Put([FromBody] stock_levels obj) { HttpResponseMessage checkIfAlreadyInExistance = Get(obj.id); if (checkIfAlreadyInExistance.StatusCode != HttpStatusCode.NotFound) { return(Request.CreateResponse(HttpStatusCode.Conflict, "An entity with id " + obj.id + " already exists.")); } stock_levels stock_levels = new stock_levels(); string outMessage = string.Empty; if (stock_levels.Update(obj, out outMessage)) { var message = Request.CreateResponse(HttpStatusCode.Accepted, obj); message.Headers.Location = new Uri(Request.RequestUri + obj.id); return(message); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotModified, outMessage)); } }