Пример #1
0
        public async Task <ActionResult <List <ProductDto> > > GetProducts([FromQuery] ProductsParameter productsParameter)
        {
            _orm.OpenConn();
            var productsFromDB = await _orm.GetAllProducts(productsParameter);

            if (productsFromDB == null)
            {
                return(NotFound());
            }
            var productsDto = _mapper.Map <List <ProductDto> >(productsFromDB);

            await _orm.CloseConn();

            return(Ok(productsDto));
        }