Create ASP.NET Core REST API Project
Use the API project template to create a REST API Project. In our case we want to add the REST API project to the BlazorTutorial solution. Here are the steps.
- Right click on the solution in the Solution Explorer and select Add - New Project.
- In the Add a new project window, select ASP.NET Core Web Application and click Next
- Name the project EmployeeManagement.Api and then click Create
4. On the next screen, select API project template and click Create
EmployeeManagement.Models.Employee class changes
In the Employees database table, we will be storing DepartmentId. So to keep the Employee model class simple, remove Department property and include DepartmentId property. The Employee class must be as shown now.
Add reference to EmployeeManagement.Models project
We need the model classes (i.e Employee and Department) defined in EmployeeManagement.Models project in EmployeeManagement.Api project . So add a project reference.
No comments:
Post a Comment