From the course: Learning ASP.NET Core: MVC, Razor Pages, Web APIs & Other Foundations

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Solution: Create a MVC application

Solution: Create a MVC application

(upbeat music) - [Instructor] Let me now show you how I'll solve the challenge. I'll first create a new project in my terminal using the dotnet cli. Remember that the short name used to create a new MVC app is just MVC. So the command I'll use is dotnet new mvc. I'll add the -o option, which is the short form of the --output option to create the project in a new folder named books-mvc. Once that's created, I'll change into the new directory and then open it in VS Code. The first thing I'm going to add to the new project is a model class for my books. The project template already created a models folder, so I'm just going to add a new file to it named Books.cs. I want this class to be in the same namespace as other model classes in the project, so I'll add a file scoped namespace at the top of the file. I'll then declare the new public class. Inside the class, I'll declare two new public properties. The first will store a list of all books in a string array I'll name Library. The…

Contents