public static VmHierarchy Build(SmHierarchy model) { return(new VmHierarchy { HierarchyId = model.HierarchyId, Depth = model.Depth, Path = model.Path, ParentId = model.ParentId, Name = model.Name }); }
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)); }
public async Task <List <SmHierarchy> > GetChildren(int hierarchyId) { var results = await _productRepository.GetChildren(hierarchyId); return(SmHierarchy.Build(results)); }