Exposing WWTravelClub packages using Web APIs
In this section, we will implement an ASP.NET REST service that lists all the packages that are available for a given vacation’s start and end dates. For didactic purposes, we will not structure the application according to the best practices we have described previously; instead, we will simply generate the results with a LINQ query that will be directly placed in the controller action method. A well-structured ASP.NET Core application has been presented in Chapter 18, Implementing Frontend Microservices with ASP.NET Core.
Let us make a copy of the WWTravelClubDB
solution folder and rename the new folder WWTravelClubWebAPI80
. The WWTravelClubDB project was built step by step in the various sections of Chapter 13, Interacting with Data in C# – Entity Framework Core. Let us open the new solution and add a new ASP.NET Core API project to it named WWTravelClubWebAPI80
(the same name as the new solution folder). For simplicity...