I need to do project which call api's from database
and make another project and call the old one which contain api's only in its controller
I face those problems 1- I want to return an object from api which takes object and return object as
this is my api which locate in "testController"
[HttpPost]
[ActionName("fetch_information")]
public login_info fetch_information(login_info_request request)
and I want to call this api from another project as
public login_info fetch_information(login_info_request request)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:58295/fetch_information");
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.GetAsync("api/"+request+"").Result;
if (response.IsSuccessStatusCode)
{
return null;
here I want to return an object of "login_info "
}
else
{
return null;
}
}
my question is where can I give it request object data "login_info_request "? and where can I recieve object from api "login_info"?
thanks in advance