Exemplo n.º 1
0
        public async Task <ActionResult <ProductToReturnDto> > GetProduct(int id)
        {
            var spec = new ProductCategoriesSpecification(id);

            var product = await _productsRepo.GetEnitityWithSpec(spec);

            return(Ok(_mapper.Map <Product, ProductToReturnDto>(product)));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <IReadOnlyList <ProductToReturnDto> > > GetProducts()
        {
            var spec = new ProductCategoriesSpecification();

            var products = await _productsRepo.ListAsync(spec);

            return(Ok(_mapper.Map <IReadOnlyList <Product>, IReadOnlyList <ProductToReturnDto> >(products)));
        }