This project is a simple MVC application built with ASP.NET Core. It was created as a solution to a programming challenge in the "Learning ASP.NET Core: MVC, Razor Pages, Web APIs & Other Foundations" course on LinkedIn Learning.
The application displays a list of books and allows the user to view a favorite book. It demonstrates the basic principles of the Model-View-Controller (MVC) pattern in ASP.NET Core.
- View a list of books.
- View a designated "favorite" book.
The application is structured as a standard ASP.NET Core MVC project:
- Models: The
Book.csandBookViewModel.csfiles define the data structure for the application. TheBookViewModelis pre-populated with a list of books. - Views: The
Index.cshtmlandFavourite.cshtmlfiles in theViews/Bookdirectory are used to display the book data to the user. - Controllers: The
BookController.csfile manages the flow of data between the models and the views. It has action methods for displaying the list of books and the favorite book.
This project is my custom solution to the "Challenge: Create a MVC Application" from the "Creating MVC Application" module of the Learning ASP.NET Core: MVC, Razor Pages, Web APIs & Other Foundations course on LinkedIn Learning.
The challenge was to:
- Create a new MVC application.
- Add a model class.
- Create a new controller.
- Add two action methods to the controller: one to display all items and another to display a favorite item.
- Create corresponding views for each action method.
- Update the layout to include links to the new action methods.
- Run the application to verify the changes.
-
Clone the repository.
-
Open a terminal in the project directory.
-
Run the command
dotnet run. -
Open a web browser and navigate to the URL provided in the terminal.
**NOTE**: If you are working with you own seperate local server device (i.e. not localhost), you might want to update the applicationUrl "localhost" substring to 0.0.0.0, so you can access the url using the device name instead of "localhost". You'll find this in the launchSettings.json file.