© Adam Freeman 2016

ADAM FREEMAN, Pro ASP.NET Core MVC , 10.1007/978-1-4842-0397-2_10

10. SportsStore: Completing the Cart

Adam Freeman

(1)Milton Keynes MK6 3PA, UK

In this chapter, I continue to build the SportsStore example app. In the previous chapter, I added the basic support for a shopping cart, and now I am going to improve on and complete that functionality.

Refining the Cart Model with a Service

I defined a Cart model class in the previous chapter and demonstrated how it can be stored using the session feature, allowing the user to build up a set of products for purchase. The responsibility for managing the persistence of the Cart class fell to the Cart controller, which explicitly defines methods for getting and storing Cart objects.

Get Pro ASP.NET Core MVC, Sixth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.