コード例 #1
0
ファイル: ProductsController.cs プロジェクト: yanpaulo/ipede
 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;
 }
コード例 #2
0
ファイル: ProductsController.cs プロジェクト: yanpaulo/ipede
 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;
 }