Example #1
0
        public async Task <CategoryesDTO> GetCategoryNames()
        {
            var repoQuery = await this._productRepository
                            .Products
                            .Select(p => p.Category)
                            .Distinct()
                            .OrderBy(p => p)
                            .ToListAsync();

            var serviceModel = new CategoryesDTO()
            {
                Categoryes = repoQuery.Select(c => c)
            };

            return(serviceModel);
        }
 public CategoryViewModel(CategoryesDTO serviceModel)
 {
     this.Categoryes = serviceModel.Categoryes.Select(c => c);
 }