Reputation: 87
I created a solution with 4 layers which its names; Api,Entities,DataAccess and Services. Now I want to add MVC project to my solution to see my datas simple web interface.(I am planning learn Html and Razor).
Api layer is ASPNet Core WebAPI project(with api controllers and CRUD processes) and the others are .Net classlibs. How can I add MVC project for views and how can I use my api from this MVC project?
Upvotes: 1
Views: 810
Reputation: 1133
Right Click on the solution in VS2019 and add project > Add Asp.net core web app. Select the right framework version, authorization if you want to use it later on.
To run multiple projects to gather on VS2019.
Right-click Solution > Set Startup Projects > Choose multiple projects > Choose your API and MVC project as the start.
Make Sure the API project is on top to start it first before the MVC project.
API endpoints
, by adding HttpClient
or HttpClientFactory
( I recommend HttpClientFactory, google its advantages).Upvotes: 4