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,700 courses taught by industry experts.

Challenge: Create a MVC application

Challenge: Create a MVC application

(bright, upbeat music) - [Instructor] It is your turn to practice creating your own MVC application. I'm going to stick with an app to manage books, but you should feel free to create an app in whatever domain you prefer. Start by using the .NET CLI to create a new application using the MVC project template. Add to your project a model class to retrieve and store information about books or whatever domain type you want to use in your app. After adding a model, use the CLI to create a new controller to handle HTTP request related to the model data. I'm going to create one named Books Controller. Add two new action methods to the new controller, one to display all books and another to display just your favorite book. Each action method should return a different view, so also create views with appropriate razor syntax to display the data gathered in the action methods. Finally, update the default layout page to include links to the two new action methods, and then run your app with the…

Contents