Пример #1
0
        public ICatalogItemContext Create(RouteData routeData, Database database)
        {
            Assert.IsNotNull(database, nameof(database));
            Assert.IsNotNull(routeData, nameof(routeData));

            var itemType = RouteConfig.GetItemType(routeData);

            switch (itemType)
            {
            case RouteItemType.CatalogItem:
                return(CreateCatalogContextFromCatalogRoute(routeData));

            case RouteItemType.Product:
                return(CreateCatalogContextFromProductRoute(routeData, database));

            case RouteItemType.Category:
                return(CreateCatalogContextFromCategoryRoute(routeData, database));

            default:
                return(CreateEmptyCatalogContext());
            }
        }