public static toolsDto.Store ToToolsStore(this Store store)
        {
            toolsDto.Store result = null;

            if (store != null)
            {
                result = new toolsDto.Store
                {
                    Id              = store.Id,
                    Url             = store.Url,
                    SecureUrl       = store.SecureUrl,
                    Catalog         = store.Catalog,
                    DefaultLanguage = store.DefaultLanguage.CultureName,
                    SeoLinksType    = store.SeoLinksType.ToToolsSeoLinksType(),
                    Languages       = store.Languages.Select(l => l.CultureName).ToList(),
                };
            }

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// Returns SEO path if all outline items of the first outline have SEO keywords, otherwise returns default value.
        /// Path: GrandParentCategory/ParentCategory/ProductCategory/Product
        /// </summary>
        /// <param name="outlines"></param>
        /// <param name="store"></param>
        /// <param name="language"></param>
        /// <param name="defaultValue"></param>
        /// <returns></returns>
        public static string GetSeoPath(this IEnumerable <Outline> outlines, Store store, string language, string defaultValue)
        {
            string result = null;

            EnumUtility.SafeParse(store.Settings.GetSettingValue("Stores.SeoLinksType", ""), toolsDto.SeoLinksType.Collapsed);

            var toolsStore = new toolsDto.Store
            {
                Id              = store.Id,
                Url             = store.Url,
                SecureUrl       = store.SecureUrl,
                Catalog         = store.Catalog,
                DefaultLanguage = store.DefaultLanguage,
                SeoLinksType    = EnumUtility.SafeParse(store.Settings.GetSettingValue("Stores.SeoLinksType", ""), toolsDto.SeoLinksType.Collapsed),
                Languages       = store.Languages?.ToList(),
            };
            var toolsOutlines = outlines?.Select(o => o.JsonConvert <toolsDto.Outline>()).ToArray();

            if (toolsOutlines != null)
            {
                result = toolsOutlines.GetSeoPath(toolsStore, language ?? store.DefaultLanguage, defaultValue);
            }
            return(result);
        }