9.1.1 Creating a Custom Model Binder; Listing 9-2 Registering the CartModelBinder Class in the Global.asax.cs File

This commit is contained in:
Jason Zhu 2021-09-18 22:28:20 +10:00
parent 1bb96ab788
commit 767b09def1

View File

@ -4,6 +4,8 @@ using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using SportsStore.Domain.Entities;
using SportsStore.WebUI.Infrastructure.Binders;
namespace SportsStore.WebUI
{
@ -13,6 +15,7 @@ namespace SportsStore.WebUI
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
ModelBinders.Binders.Add(typeof(Cart), new CartModelBinder());
}
}
}