How to Return values in WebAPI

Posted by Baligani under ASP.NET Web API on 6/7/2017 | Points: 10 | Views : 257 | Status : [Member] | Replies : 2
[HttpGet]

public DataTable GetFloorDetails()


{

localhost.FloorDetails test = new localhost.FloorDetails();

test.BuildingID; /error only call assignment,increment
test.Lang; /Error For only call assignment,increment
return ? ; // to return values

}

am new to .net any one help pls.




Responses

Posted by: Sheonarayan on: 6/7/2017 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
ASP.NET Web API supports http protocol so you would not be able to return DataTable, you will have to convert that to string (preferably JSON).

Read this http://techfunda.com/howto/302/list-records-using-web-api and learn how to do this.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Baligani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Baligani on: 6/8/2017 [Member] Starter | Points: 25

Up
0
Down
I have WebService Method Name Called "FloorDetails" This method need invoke WebAPI.I create webAPI in Add service reference to ASMX .But i dont how to Retrieve Values.

localhost.FloorDetails test = new localhost.FloorDetails();
Test.BuildID=2;


help this one.


Baligani, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response