//edit
        public IActionResult Edit(string id)
        {
            var checkoutAttribute = _checkoutAttributeService.GetCheckoutAttributeById(id);

            if (checkoutAttribute == null)
            {
                //No checkout attribute found with the specified id
                return(RedirectToAction("List"));
            }

            var model = checkoutAttribute.ToModel();

            //locales
            AddLocales(_languageService, model.Locales, (locale, languageId) =>
            {
                locale.Name       = checkoutAttribute.GetLocalized(x => x.Name, languageId, false, false);
                locale.TextPrompt = checkoutAttribute.GetLocalized(x => x.TextPrompt, languageId, false, false);
            });

            //tax categories
            _checkoutAttributeViewModelService.PrepareTaxCategories(model, checkoutAttribute, false);
            //Stores
            model.PrepareStoresMappingModel(checkoutAttribute, false, _storeService);

            //condition
            _checkoutAttributeViewModelService.PrepareConditionAttributes(model, checkoutAttribute);
            //ACL
            model.PrepareACLModel(checkoutAttribute, false, _customerService);
            //Stores
            model.PrepareStoresMappingModel(checkoutAttribute, false, _storeService);

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> Edit(string id)
        {
            var checkoutAttribute = await _checkoutAttributeService.GetCheckoutAttributeById(id);

            if (checkoutAttribute == null)
            {
                //No checkout attribute found with the specified id
                return(RedirectToAction("List"));
            }

            var model = checkoutAttribute.ToModel();

            //locales
            await AddLocales(_languageService, model.Locales, (locale, languageId) =>
            {
                locale.Name       = checkoutAttribute.GetTranslation(x => x.Name, languageId, false);
                locale.TextPrompt = checkoutAttribute.GetTranslation(x => x.TextPrompt, languageId, false);
            });

            //tax categories
            await _checkoutAttributeViewModelService.PrepareTaxCategories(model, checkoutAttribute, false);

            //condition
            await _checkoutAttributeViewModelService.PrepareConditionAttributes(model, checkoutAttribute);

            return(View(model));
        }