當前位置: 首頁>>代碼示例>>C#>>正文


C# Category.ToAUModel方法代碼示例

本文整理匯總了C#中Nop.Core.Domain.Catalog.Category.ToAUModel方法的典型用法代碼示例。如果您正苦於以下問題:C# Category.ToAUModel方法的具體用法?C# Category.ToAUModel怎麽用?C# Category.ToAUModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nop.Core.Domain.Catalog.Category的用法示例。


在下文中一共展示了Category.ToAUModel方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Category


//.........這裏部分代碼省略.........
            {
                category = _categoryService.GetCategoryById(categoryId);
                if (category == null || category.Deleted)
                    return InvokeHttp404();

                //Check whether the current user has a "Manage catalog" permission
                //It allows him to preview a category before publishing
                if (!category.Published && !_permissionService.Authorize(StandardPermissionProvider.ManageCategories))
                    return InvokeHttp404();

                //ACL (access control list)
                if (!_aclService.Authorize(category))
                    return InvokeHttp404();

                //Store mapping
                if (!_storeMappingService.Authorize(category))
                    return InvokeHttp404();
            }
            else
            {
               //NJM: TODO Stuff page info for now until you add to AUSale (like Category)
                category.AllowCustomersToSelectPageSize = true;
                category.PageSizeOptions = "6,3,9";
                category.PageSize = 6;
            }

            //TODO: come back to this to save the last page to continue shopping 
            ////////'Continue shopping' URL
            //////_genericAttributeService.SaveAttribute(_workContext.CurrentCustomer,
            //////    SystemCustomerAttributeNames.LastContinueShoppingPage,
            //////    _webHelper.GetThisPageUrl(false),
            //////    _storeContext.CurrentStore.Id);

            var model = category.ToAUModel();     //NJM: this maps Category to AUCategory but does not populate nested classes

            if (inSaleId != 0)  //NJM: coming off sale navigator or breadcrumb, so get the sale title
            {
                var sale = _saleRepo.GetById(inSaleId);
                if (sale == null)
                {
                    throw new NopException("SaleId not found for category " + saleId);
                }

                model.SaleId = inSaleId;              //this is needed to allow hyperlink to specify sale constraint
                model.SaleTitle = sale.SaleTitle;  //this is needed for the breadcrumb
            }

            //sorting
            PrepareSortingOptions(model.PagingFilteringContext, command);
            //view mode
            PrepareViewModes(model.PagingFilteringContext, command);
            //page size
            PreparePageSizeOptions(model.PagingFilteringContext, command,
                category.AllowCustomersToSelectPageSize,
                category.PageSizeOptions,
                category.PageSize);


            //price ranges
            //TODO:  insert *estimate* in here for filtering?
            model.PagingFilteringContext.PriceRangeFilter.LoadPriceRangeFilters(category.PriceRanges, _webHelper, _priceFormatter);
            var selectedPriceRange = model.PagingFilteringContext.PriceRangeFilter.GetSelectedPriceRange(_webHelper, category.PriceRanges);
            decimal? minPriceConverted = null;
            decimal? maxPriceConverted = null;
            if (selectedPriceRange != null)
            {
開發者ID:HumanSystems,項目名稱:nopcommerce-dev,代碼行數:67,代碼來源:AUPublicController.cs


注:本文中的Nop.Core.Domain.Catalog.Category.ToAUModel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。