This material is public and published on YouTube by "CodAffection".
It is a 2 hour tutorial titled "ASP.NET Core Web API CRUD with Angular 11".
The tutorial first builds the API in .NET Core and test the CRUD functions.
Then an Angular app is created and developed in VS code.
Finally, the angular app is connected the API and the CRUD functionality is tested again.
Tools used = .NET 5, Visual Studio, Entity Framewrk Core, Swagger, VS Code, Node, NPM, Angular, SQL Server Management Studio, etc.
'Add Migration "Initial"', this command creates a migrations folder.
The migration file contains two methods.
One to upgrade the database and one to downgrade the database.
The "update database" command applies te latest migration.
In this case it executes the code inside the "initial" migations folder.
This creates the SQL database.
This controller was created with "scaffolding".
Swagger was used to test the API endpoints.
Below I have entered data into the request body and posted it.
The resource was created successfully (201).
I created two more resources and then tested the "Get All" method.
Finally I checked the database aswell to see if it contained the data.
In order to keep following the tutorial I had to install node.js, npm manager, angular and VS code.
The Angular app was built in ""VS code"" whilst the .NET Core API was built in Visual Studio.
npm install npm@latest -g
ng new nameOfFile
Inject service class into form component ts file (dependency injection constructor).
This inserts the form.
The id field for te form is hidden.
If it is a POST, the id will be 0 which triggers "insertRecord".
If it is a PUT, the id will not be 0 which triggers "updateRecord".