Using MVC, Entity Framework, and ASP.NET Scaffolding, we will go through building a small school management system while learning key concepts in ASP.NET MVC development.
This course will show you how to automatically generate code that enables users to display, edit, create, and delete data that resides in a database table. The generated code corresponds to the columns in the database table.
In the last part of the series, you learn how add data annotations to the data model to specify validation requirements and display formatting.
At the end of this course, you should be able to build a fully data driven web application. You may proceed to more advanced courses regarding user authentication and hosting.
Setup ASP.Net MVC Application
This lecture teaches ASP.NET MVC web development with controllers and views. We will learn how to:
Create a web app.
You will now create Entity Framework models from the database tables. These models are classes that you will use to work with the data.
Each model mirrors a table in the database and contains properties that correspond to the columns in the table.
You need to fully appreciate how we create pages and add content to our website.
In this lesson, you will learn how to create new views and create links to browse to them. Also, we will tour the folder structure and develop an appreciation for the files and what they do in our project.
You are ready to generate code that will provide standard data operations for the model classes. You add the code by adding a scaffold item. There are many options for the type of scaffolding you can add.
In this lesson, the scaffold will include a controller and views that correspond to the Course models you created in the previous lesson.
If you update the structure of a table in your database, you need to ensure that your change is propagated to the data model, views, and controller.
For this lesson, you will add a new column to the Student table to record the middle name of the student.
To add this column, open the database and through the designer or the T-SQL code, add a column named MiddleName that is an NVARCHAR(50) and allows NULL values.