<div class="post-text" itemprop="text">
my web api action return data bit different way. see my action code
[HttpGet]
[Route("GetByID/{customerID}")]
public HttpResponseMessage GetCustomer(string customerID)
{
Customer customer = repository.Get(customerID);
if (customer == null)
{
throw new HttpResponseException(HttpStatusCode.NotFound);
}
Response response = new Response(1, "SUCCESS", customer);
return Request.CreateResponse(HttpStatusCode.OK, response);
}my Response class code in which i wrapped the data as object and return to client.
public class Response
{
int ResponseCode;
string ResponseMessage;
object ResponseData;
public Response(int code, string message, object data)
{
ResponseCode = code;
ResponseMessage = message;
ResponseData = data;
}
}now i like to know how could i call my web api by
http clientand extract customer data and show the customer data through
datagridview.</div>