Divided the project into Section for own understanding.
- Models - Class structure which will be used
- Service - Actual Functionality
- Program.cs - Regsiter the Service to be used. Asp.net core dependency injection
- On the Actual Page - PageName.cshtml - Page Constructor - Call the Service
https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection?view=aspnetcore-6.0
- builder.Services.AddScoped();
- builder.Services.AddScoped();
With this you can change the implemention of the method without doing changes on all the pages