Esempio n. 1
0
        public static Category ToCategoryModel(DBCategory dbModel,List<DBCategory> childCategories)
        {
            if (dbModel == null) return null;

            List<Category> children = new List<Category>();

            if(childCategories!=null)
            {
            foreach (DBCategory dbCategory in childCategories)
            {
                children.Add(ToCategoryModel(dbCategory));
            }
            }
            return ToCategoryModel(dbModel, children);
        }
Esempio n. 2
0
        public static Category ToCategoryModel(DBCategory dbModel,List<Category> childCategories = null)
        {
            if(dbModel == null)return null;

            Id parentId;

            if (dbModel.ParentId.HasValue)
            {
                parentId = new Id(dbModel.ParentId.Value);
            }
            else
                parentId = null;
            return new Category
            {
                CategorySet = childCategories,
                Id = new Id(dbModel.CategoryId),
                DomainId = new Id(dbModel.DomainId),
                Title = dbModel.Title,
                ParentId = parentId
            };
        }