Example #1
0
 public static VmHierarchy Build(SmHierarchy model)
 {
     return(new VmHierarchy
     {
         HierarchyId = model.HierarchyId,
         Depth = model.Depth,
         Path = model.Path,
         ParentId = model.ParentId,
         Name = model.Name
     });
 }
Example #2
0
        public async Task <List <SmHierarchy> > GetAll(int?depth = null)
        {
            List <Hierarchy> entities;

            if (depth == null)
            {
                entities = await _productRepository.GetAll();
            }
            else
            {
                entities = await _productRepository.GetByDepth((int)depth);
            }

            return(SmHierarchy.Build(entities));
        }
Example #3
0
        public async Task <List <SmHierarchy> > GetChildren(int hierarchyId)
        {
            var results = await _productRepository.GetChildren(hierarchyId);

            return(SmHierarchy.Build(results));
        }