Create and use Web APIs to create webapis
Today I made an exercise to implement a separate Web API project. Previously, it was created only in the ASP. net mvc project.
To create a Web API project, follow these steps:
After you click OK, another window is displayed:
Create a table in the database:
Based on this table, we create a model in the API project:
Next, we can create a controller:
Select Web API 2 Controller-Empty:
The Controller has been created as follows:
Create several stored procedures in the database:
In the Web API project, create a directory Entities and create an entity SizeEntity:
The Api controller created on the Back-to-top interface:
Next, you need to publish the Web API item directory to the IIS website.
Publish to IIS:
Enter the address in the browser:
Source code of this article:
Http://download.cnblogs.com/insus/mvc/MiZiAPI.rar