private List<Category> GetCategoryPath(Category category) { List<Category> categoryPath = new List<Models.Entities.Category>(); categoryPath.Add(category); while (category.ParentCategory != null) { categoryPath.Add(category.ParentCategory); category = category.ParentCategory; } categoryPath.Reverse(); return categoryPath; }
private CategoryDTO MapCategory(Category c) { CategoryDTO ret = mapper.Map<Category, CategoryDTO>(c); foreach (var sub in ret.SubCategories) { foreach (var p in sub.Products) { SetupProductDTO(p); } } foreach (var p in ret.Products) { SetupProductDTO(p); } return ret; }