locked
How do I test Put Method RRS feed

  • Question

  • User-400158872 posted

    I have following code for Put method for my ProductController.

    public HttpResponseMessage Put(int id, Product product)
            {
                if (ModelState.IsValid && id == product.Id)
                {
                    var result = _repository.Update(id, product);
                    if (result == false)
                    {
                        return Request.CreateResponse(HttpStatusCode.NotFound);
                    }
                    return Request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    return Request.CreateResponse(HttpStatusCode.BadRequest);
                }
            }

    How can i test this method in the browser using fiddler or any other developer tools for chrome. 

    I tried using Put method using Advanced Client Rest but got the error.

    {"Message":"No HTTP resource was found that matches the request URI 'http://localhost:34133/api/product/'.","MessageDetail":"No action was found on the controller 'Product' that matches the request."}

    Friday, August 28, 2015 2:18 PM

Answers

All replies