The tutorial ASP.NET Core MVC has content:
- Get started
- Add a controller
- Add a view
- Add a model - scaffold movie pages (updates/creates files)
- Work with a database
- Controller actions and views
- Add search
- Add a new field
- Add validation
- Examine Details and Delete
Add a model
Below codes create database table based on model
Add-Migration InitialCreate
Update-Database
Make sure appsetrtings.json has correct connection string to winhost to create / update table.
After running localhost, Program.cs run code block and inserts default 4 records into database.
using (var scope = app.Services.CreateScope())
{
var services = scope.ServiceProvider;
SeedData.Initialize(services);
}
Add a new field
Add-Migration Rating
Update-Database
<questions>
private readonly MvcMovieContext _context;
q. when this context is setup?
ans. Controller >> right click >> add >> New scaffolded item ...
<next>
How to deploy
https://stackify.com/how-to-deploy-asp-net-core-to-iis/
What's ASP.NET Core?
https://stackify.com/asp-net-core-features/
Local database
Use ServerName = (LocalDb)\MSSQLLocalDB