Example #1
0
        public ActionResult <IEnumerable <ProductViewModel> > Get([FromQuery] BrowseProducts query)
        {
            var products = _productsProvider.Products.AsEnumerable();

            if (!string.IsNullOrWhiteSpace(query.Name))
            {
                products = products.Where(p => p.Name.Contains(query.Name));
            }

            return(Ok(products));
        }
Example #2
0
        public async Task <ActionResult <IEnumerable <ProductDto> > > Get([FromQuery] BrowseProducts query)
        {
            var products = await _productService.BrowseAsync(query.Name);

            return(Ok(products));
        }