This is a ready-to-run template for your final project. It uses:
- .NET 8 Web API
- Entity Framework Core (Code-First) with SQL Server LocalDB
- NSwag for OpenAPI/Swagger UI
- Four controllers: TeamMembers, Hobbies, FavoriteFoods, WorkoutPlans
- Open the solution by opening
FinalProjectAPI.csprojin Visual Studio. - Open Package Manager Console (Tools → NuGet Package Manager → Package Manager Console)
- Run EF Core migrations:
Add-Migration InitialCreate Update-Database
- Press F5 to run. Browser should open at
/swagger. - Test CRUD endpoints in Swagger UI.
GET /api/TeamMembers/{id?}returns first 5 whenidis null or 0.
Each GET {id?} endpoint accepts a nullable id. When id is null or 0, it returns the first 5 items. Otherwise it returns the entity by id or 404.
On startup, after migrations, the app seeds sample rows if the tables are empty.