// POST api/product public HttpResponseMessage Post(Product item) { HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest); if (item != null && ModelState.IsValid) { ProductServiceClient productService = new iSnackServiceReference.ProductServiceClient(); var mapper = ObjectMapperManager.DefaultInstance.GetMapper<Product, ProductEntity>(); var product = mapper.Map(item); bool isSucc = productService.Create(product); if (isSucc) { //HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, item); //response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = item.ID })); response = Request.CreateResponse(HttpStatusCode.Created, new { success = true }); } } return response; }