Web API with ASP.NET Core
Web API (Application Programming Interface) is web development concept for either a Web Browser or Web Server. It’s usually limited to application's client-side for any web frameworks. Thus usually does not include web server or browser implementation details unless publicly accessible by a remote web application.
Steps for creating first Web API:
1. Create New ASP.NET CORE Web Application:
2. Select Web API:
3. Create Models folder in Web API Project
4.Add class in Models folder. Name it as APIModel
5. Define Data Parameters with data type in APIModel
6. Create new folder Repository
7. Add Interface class FirstInterface into Repository.
Define all the methods you want to implement using web api.
8.Add Repository class FirstRepository inside Repository.
Inherit interface class into Repository class and then by clicking quick actions, click implement. It will lead the Repository class to access all the methods you have defined inside interface. Inside those methods, write functions for CRUD operation or anything that you want to for the project.
9. Create new folder APIController.
10.Add New APIController class into APIController folder
Now this APIController will act as the medium between the code and client side. Define the methods and just call the Repository class to use data manipulation functions. Now you can easily access the api controller by just calling the correct api method path.