public List <Category> GetAllCategories() { var allDbCategories = prdClient.GetAllCategories(); List <Category> allCategoriesList = new List <Category>(); foreach (var category in allDbCategories) { var add = new Category() { CategoryId = category.CategoryId, Name = category.Name, Products = category.Products == null ? new List <Product>() : category.Products.Select(x => x.MapTopProduct()).Where(x => x.CategoryId == category.CategoryId).ToList() }; allCategoriesList.Add(add); } return(allCategoriesList); }
public List <string> GetAllCategories() { ProductServiceClient proxy = new ProductServiceClient(); return(proxy.GetAllCategories().ToList()); }