Пример #1
0
        public async Task <IActionResult> EditCategory(string id)
        {
            var knowledgebaseCategory = await _knowledgebaseService.GetKnowledgebaseCategory(id);

            if (knowledgebaseCategory == null)
            {
                return(RedirectToAction("List"));
            }

            var model = knowledgebaseCategory.ToModel();
            await _knowledgebaseViewModelService.PrepareCategory(model);

            await AddLocales(_languageService, model.Locales, (locale, languageId) =>
            {
                locale.Name            = knowledgebaseCategory.GetLocalized(x => x.Name, languageId, false, false);
                locale.Description     = knowledgebaseCategory.GetLocalized(x => x.Description, languageId, false, false);
                locale.MetaDescription = knowledgebaseCategory.GetLocalized(x => x.MetaDescription, languageId, false, false);
                locale.MetaKeywords    = knowledgebaseCategory.GetLocalized(x => x.MetaKeywords, languageId, false, false);
                locale.MetaTitle       = knowledgebaseCategory.GetLocalized(x => x.MetaTitle, languageId, false, false);
                locale.SeName          = knowledgebaseCategory.GetSeName(languageId, false, false);
            });

            await model.PrepareACLModel(knowledgebaseCategory, false, _customerService);

            model.SelectedCustomerRoleIds = knowledgebaseCategory.CustomerRoles.ToArray();

            //Stores
            await model.PrepareStoresMappingModel(knowledgebaseCategory, _storeService, false);

            return(View(model));
        }
Пример #2
0
        public async Task <IActionResult> EditCategory(string id)
        {
            var knowledgebaseCategory = await _knowledgebaseService.GetKnowledgebaseCategory(id);

            if (knowledgebaseCategory == null)
            {
                return(RedirectToAction("List"));
            }

            var model = knowledgebaseCategory.ToModel();
            await _knowledgebaseViewModelService.PrepareCategory(model);

            await AddLocales(_languageService, model.Locales, (locale, languageId) =>
            {
                locale.Name            = knowledgebaseCategory.GetTranslation(x => x.Name, languageId, false);
                locale.Description     = knowledgebaseCategory.GetTranslation(x => x.Description, languageId, false);
                locale.MetaDescription = knowledgebaseCategory.GetTranslation(x => x.MetaDescription, languageId, false);
                locale.MetaKeywords    = knowledgebaseCategory.GetTranslation(x => x.MetaKeywords, languageId, false);
                locale.MetaTitle       = knowledgebaseCategory.GetTranslation(x => x.MetaTitle, languageId, false);
                locale.SeName          = knowledgebaseCategory.GetSeName(languageId, false);
            });

            return(View(model));
        }