Exemplo n.º 1
0
        public async Task <IActionResult> Create([FromServices] CatalogSettings catalogSettings)
        {
            var model = new ManufacturerModel();

            //locales
            await AddLocales(_languageService, model.Locales);

            //templates
            await _manufacturerViewModelService.PrepareTemplatesModel(model);

            //discounts
            await _manufacturerViewModelService.PrepareDiscountModel(model, null, true);

            //ACL
            await model.PrepareACLModel(null, false, _customerService);

            //Stores
            await model.PrepareStoresMappingModel(null, _storeService, false, _workContext.CurrentCustomer.StaffStoreId);

            //default values
            model.PageSize        = catalogSettings.DefaultManufacturerPageSize;
            model.PageSizeOptions = catalogSettings.DefaultManufacturerPageSizeOptions;
            model.Published       = true;
            model.AllowCustomersToSelectPageSize = true;
            //sort options
            _manufacturerViewModelService.PrepareSortOptionsModel(model);

            return(View(model));
        }
        public IActionResult Create([FromServices] CatalogSettings catalogSettings)
        {
            var model = new ManufacturerModel();

            //locales
            AddLocales(_languageService, model.Locales);
            //templates
            _manufacturerViewModelService.PrepareTemplatesModel(model);
            //discounts
            _manufacturerViewModelService.PrepareDiscountModel(model, null, true);
            //ACL
            model.PrepareACLModel(null, false, _customerService);
            //Stores
            model.PrepareStoresMappingModel(null, false, _storeService);
            //default values
            model.PageSize        = catalogSettings.DefaultManufacturerPageSize;
            model.PageSizeOptions = catalogSettings.DefaultManufacturerPageSizeOptions;
            model.Published       = true;
            model.AllowCustomersToSelectPageSize = true;

            return(View(model));
        }