Wednesday, January 22, 2014

A look into Web API - Creating a simple Web API application... - Part 2



Click here to view part 1



Lets create a model class for our sample and use it to test...





I had created a class called TestData.cs and defined it as below.




As said, I am extending the class from ApiController and added the following code...




Above code will make use of my model TestData to generate some sample data and to display them when invoked.

Now we are all set to run this web service and display the data to end users. When you press F5, you should be able to see the result below.. (I am using chrome to run it)



That's just getting started with Web API's... Happy coding...

No comments:

Post a Comment