コード例 #1
0
        public Category(Models.GetProducts.Category category)
        {
            var categoryDeepClone = category.DeepClone();

            this.Id        = categoryDeepClone.Id;
            this.ParentId  = categoryDeepClone.ParentId;
            this.Level     = categoryDeepClone.Level;
            this.Name      = categoryDeepClone.Name;
            this.IsActive  = categoryDeepClone.IsActive;
            this.Childrens = categoryDeepClone.Childrens.Select(x => new Category(x)).ToList();
        }
コード例 #2
0
        public Models.GetProducts.Category ToCategory()
        {
            var result = new Models.GetProducts.Category(this.Id.ToString())
            {
                ParentId = this.ParentId,
                Level    = this.Level,
                Name     = this.Name,
                IsActive = this.IsActive,
            };

            if (this.Childrens != null)
            {
                result.Childrens = this.Childrens.Select(z => z.ToCategory()).ToList();
            }

            return(result);
        }