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)); }
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))); }