public static coreModels.MenuLinkList ToCoreModel(this webModels.MenuLinkList list)
		{
            var retVal = new coreModels.MenuLinkList();
            retVal.InjectFrom(list);

            foreach(var link in list.MenuLinks)
            {
                retVal.MenuLinks.Add(link.ToCoreModel());
            }

            return retVal;
		}
Beispiel #2
0
        public static coreModels.MenuLinkList ToCoreModel(this webModels.MenuLinkList list)
        {
            var retVal = new coreModels.MenuLinkList();

            retVal.InjectFrom(list);

            foreach (var link in list.MenuLinks)
            {
                retVal.MenuLinks.Add(link.ToCoreModel());
            }

            return(retVal);
        }
        /// <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));
            }
        }
		public static coreModels.MenuLinkList ToCoreModel(this webModels.MenuLinkList list)
		{
			var retVal = new coreModels.MenuLinkList
			             {
			                 Id = list.Id,
			                 Name = list.Name,
			                 StoreId = list.StoreId,
			                 Language = list.Language,
			                 MenuLinks = list.MenuLinks.Select(s => s.ToCoreModel()).ToList()
			             };

			return retVal;
		}
        public static coreModels.MenuLinkList ToCoreModel(this webModels.MenuLinkList list)
        {
            var retVal = new coreModels.MenuLinkList
            {
                Id        = list.Id,
                Name      = list.Name,
                StoreId   = list.StoreId,
                Language  = list.Language,
                MenuLinks = list.MenuLinks.Select(s => s.ToCoreModel()).ToList()
            };

            return(retVal);
        }
        private coreModels.MenuLinkList ConvertToCoreModel(MenuLinkList list)
        {
            var retVal = new coreModels.MenuLinkList();

            retVal.InjectFrom(list);

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

            return(retVal);
        }
Beispiel #7
0
        public void Attach(MenuLinkList list)
        {
            this.Name = list.Name;
            this.Language = list.Language;

            foreach (var link in list.MenuLinks)
            {
                if (string.IsNullOrEmpty(link.Id) || !this.MenuLinks.Any(l => l.Id == link.Id))
                {
                    this.MenuLinks.Add(link);
                }
                else
                {
                    var existingLink = this.MenuLinks.First(l => l.Id == link.Id);
                    existingLink.Url = link.Url;
                    existingLink.Title = link.Title;
                    existingLink.IsActive = link.IsActive;
                    existingLink.Priority = link.Priority;
                }
            }
        }
Beispiel #8
0
        public void Attach(MenuLinkList list)
        {
            this.Name     = list.Name;
            this.Language = list.Language;

            foreach (var link in list.MenuLinks)
            {
                if (!this.MenuLinks.Any(l => l.Id == link.Id))
                {
                    this.MenuLinks.Add(link);
                }
                else
                {
                    var existingLink = this.MenuLinks.First(l => l.Id == link.Id);
                    existingLink.Url      = link.Url;
                    existingLink.Title    = link.Title;
                    existingLink.IsActive = link.IsActive;
                    existingLink.Priority = link.Priority;
                }
            }
        }
Beispiel #9
0
        public static webModels.MenuLinkList ToWebModel(this coreModels.MenuLinkList list)
        {
            if (list == null)
            {
                return(null);
            }

            var retVal = new webModels.MenuLinkList
            {
                Id       = list.Id,
                Name     = list.Name,
                StoreId  = list.StoreId,
                Language = list.Language
            };

            if (list.MenuLinks.Any())
            {
                retVal.MenuLinks = list.MenuLinks.OrderByDescending(l => l.Priority).Select(s => s.ToWebModel()).ToArray();
            }

            return(retVal);
        }
        private coreModels.MenuLinkList ConvertToCoreModel(MenuLinkList list)
        {
            var retVal = new coreModels.MenuLinkList();

            retVal.InjectFrom(list);

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

            return retVal;
        }