In addition to the properties you'd expect to model a movie, the `ID` field is required by the database for the primary key. Build the app to verify you don't have any errors.
We've finally added a **M**odel to our **M**VC app.
## Prepare the project for scaffolding
- Add the following highlighted NuGet packages to the *MvcMovie.csproj* file:
- Build and run the project to verify there are no errors.
### Scaffold the MovieController
Open a terminal window in the project folder and run the following commands:
```console
dotnet restore
dotnet aspnet-codegenerator controller -name MovieController -m Movie -dc MvcMovieContext
```
The scaffolding engine creates the following:
* A movies controller (*Controllers/MoviesController.cs*)
* Create, Delete, Details, Edit and Index Razor view files (*Views/Movies*)
Scaffolding automatically created the [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) (create, read, update, and delete) action methods and views for you. The automatic creation of CRUD action methods and views is known as *scaffolding*. You'll soon have a fully functional web application that lets you create, list, edit, and delete movie entries.
If you run the app and click on the **Mvc Movie** link, you'll get an error similar to the following:
```text
An unhandled exception occurred while processing the request.
SqlException: Cannot open database "MvcMovieContext"
requested by the login. The login failed.
Login failed for user Rick
```
### Clean up the scaffolding
- Move the `MovieController.cs` file to the *Controlers* folder. By convention, controllers are in the this folder.
- Remove the `Layout` markup in each of the Razor view files in the *Views/Movie* folder. Remove the following code:
```html
@{
Layout = null;
}
```
The `dotnet new mvc` generated code includes the *Views/Shared/_Layout.cshtml* Razor layout file which we'll use in each view. *Views/Shared/_Layout.cshtml* is automatically imported into each view with the *Views/_ViewStart.cshtml* Razor view file: