Exemple #1
0
        public async Task <ICollection <Product> > SelectProductsAsync(string partOfName = null)
        {
            ICollection <Product> products = partOfName == null ?
                                             await productRepository.SelectAllAsync() :
                                             await productRepository.SelectByNameAsync(partOfName);

            return(products);
            //return products.Where(p => p.IsDiscontinued == false).ToList();
        }
        public async Task <IActionResult> GetByNameAsync(string id)
        {
            var products = await productRepository.SelectByNameAsync(id);

            if (products == null)
            {
                return(NotFound());
            }
            return(Ok(products));
        }