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

            var product = await _productsRepo.GetEntityWithSpec(spec);

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

            var products = await _productsRepo.ListAsync(spec);

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