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)); }
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))); }
public async Task <ActionResult <Product> > GetProduct(int id) { var spec = new ProductsWithTypesAndBrandsSPecification(id); return(await _productsRepo.GetEntityWithSpec(spec)); }