public async Task <ActionResult <ProductToReturnDto> > GetProduct(int id)
        {
            var spec = new ProductsWithTypesAndBrandsSPecification(id);

            var product = await _productsRepo.GetEntityWithSpec(spec);

            return(_mapper.Map <Product, ProductToReturnDto>(product));
        }
Exemple #2
0
        public async Task <ActionResult <List <Product> > > GetProducts()
        {
            var spec = new ProductsWithTypesAndBrandsSPecification();

            var products = await _productsRepo.ListAsync(spec);

            return(Ok(products));
        }
        public async Task <ActionResult <IReadOnlyList <ProductToReturnDto> > > GetProducts()
        {
            var spec = new ProductsWithTypesAndBrandsSPecification();

            var products = await _productsRepo.ListAsync(spec);

            return(Ok(_mapper.Map <IReadOnlyList <Product>, IReadOnlyList <ProductToReturnDto> >(products)));
        }
Exemple #4
0
        public async Task <ActionResult <Product> > GetProduct(int id)
        {
            var spec = new ProductsWithTypesAndBrandsSPecification(id);

            return(await _productsRepo.GetEntityWithSpec(spec));
        }