7 SportsStore: A real application

 

This chapter covers

  • Creating the SportsStore ASP.NET Core project
  • Adding a data model and support for a database
  • Displaying a basic product catalog
  • Paginating data
  • Styling content

In the previous chapters, I built quick and simple ASP.NET Core applications. I described ASP.NET Core patterns, the essential C# features, and the tools that good ASP.NET Core developers require. Now it is time to put everything together and build a simple but realistic e-commerce application.

My application, called SportsStore, will follow the classic approach taken by online stores everywhere. I will create an online product catalog that customers can browse by category and page, a shopping cart where users can add and remove products, and a checkout where customers can enter their shipping details. I will also create an administration area that includes create, read, update, and delete (CRUD) facilities for managing the catalog, and I will protect it so that only logged-in administrators can make changes.

My goal in this chapter and those that follow is to give you a sense of what real ASP.NET Core development is by creating as realistic an example as possible. I want to focus on ASP.NET Core, of course, so I have simplified the integration with external systems, such as the database, and omitted others entirely, such as payment processing.

7.1 Creating the projects

7.1.1 Creating the unit test project

7.1.2 Opening the projects

7.1.3 Configuring the HTTP port

7.1.4 Creating the application project folders

7.1.5 Preparing the services and the request pipeline

7.1.6 Configuring the Razor view engine

7.1.7 Creating the controller and view

7.1.8 Starting the data model

7.1.9 Checking and running the application

7.2 Adding data to the application

7.2.1 Installing the Entity Framework Core packages

7.2.2 Defining the connection string

7.2.3 Creating the database context class

7.2.4 Configuring Entity Framework Core

7.2.5 Creating a repository

7.2.6 Creating the database migration

7.2.7 Creating seed data

7.3 Displaying a list of products

7.3.1 Preparing the controller