コード例 #1
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;
		}
コード例 #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);
        }
コード例 #3
0
        /// <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));
            }
        }
コード例 #4
0
		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;
		}
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #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;
                }
            }
        }
コード例 #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;
                }
            }
        }
コード例 #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);
        }
コード例 #10
0
        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;
        }