Ejemplo n.º 1
0
        public static MenuLinkList ToWebModel(this VirtoCommerceContentWebModelsMenuLinkList serviceModel, IStorefrontUrlBuilder urlBuilder)
        {
            var webModel = new MenuLinkList();

            webModel.InjectFrom(serviceModel);

            webModel.Language = string.IsNullOrEmpty(serviceModel.Language) ? Language.InvariantLanguage : new Language(serviceModel.Language);

            if (serviceModel.MenuLinks != null)
            {
                webModel.MenuLinks = serviceModel.MenuLinks.Select(ml => ml.ToWebModel(urlBuilder)).ToList();
            }

            return(webModel);
        }
Ejemplo n.º 2
0
        public static MenuLinkList ToWebModel(this ContentModule.Client.Model.MenuLinkList serviceModel)
        {
            var webModel = new MenuLinkList();

            webModel.InjectFrom(serviceModel);

            webModel.Language = string.IsNullOrEmpty(serviceModel.Language) ? Language.InvariantLanguage : new Language(serviceModel.Language);

            if (serviceModel.MenuLinks != null)
            {
                webModel.MenuLinks = serviceModel.MenuLinks.Select(ml => ml.ToWebModel()).ToList();
            }

            return(webModel);
        }
        public virtual MenuLinkList ToMenuLinkList(contentDto.MenuLinkList menuLinkListDto)
        {
            var result = new MenuLinkList();

            result.InjectFrom <NullableAndEnumValueInjecter>(menuLinkListDto);

            result.Language = string.IsNullOrEmpty(menuLinkListDto.Language) ? Language.InvariantLanguage : new Language(menuLinkListDto.Language);

            if (menuLinkListDto.MenuLinks != null)
            {
                result.MenuLinks = menuLinkListDto.MenuLinks.Select(ToMenuLink).ToList();
            }

            return(result);
        }
        /// <summary>
        /// Patch changes
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public static void Patch(this MenuLinkList source, MenuLinkList target)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            var patchInjectionPolicy = new PatchInjection <MenuLinkList>(x => x.Language, x => x.Name);

            target.InjectFrom(patchInjectionPolicy, source);

            if (!source.MenuLinks.IsNullCollection())
            {
                source.MenuLinks.Patch(target.MenuLinks, (sourceLink, targetLink) => sourceLink.Patch(targetLink));
            }
        }
Ejemplo n.º 5
0
        public static MenuLinkList ToWebModel(this VirtoCommerceContentWebModelsMenuLinkList serviceModel, IStorefrontUrlBuilder urlBuilder)
        {
            var webModel = new MenuLinkList();

            webModel.InjectFrom(serviceModel);

            if (serviceModel.MenuLinks != null)
            {
                webModel.MenuLinks = serviceModel.MenuLinks.Select(ml => ml.ToWebModel(urlBuilder)).ToList();
            }
            if (serviceModel.SecurityScopes != null)
            {
                webModel.SecurityScopes = serviceModel.SecurityScopes.Select(ss => ss).ToList();
            }

            return(webModel);
        }
Ejemplo n.º 6
0
        private MenuLinkList ConvertToExportModel(coreModels.MenuLinkList list)
        {
            var retVal = new MenuLinkList();

            retVal.InjectFrom(list);

            foreach (var link in list.MenuLinks)
            {
                var addedLink = new MenuLink();
                addedLink.InjectFrom(link);
                retVal.MenuLinks.Add(addedLink);
            }

            return retVal;
        }