Esempio n. 1
0
        public async Task <ProductDto> SearchProductAsync(string productName)
        {
            var product = await _productRepository.SearchAsync(productName);

            var productDto = ProductMapper.GetProductDto(product);

            return(productDto);
        }
Esempio n. 2
0
        public async Task <Products> GetAllAsync()
        {
            var products = await _productRepository.GetAllAsync();

            return(new Products()
            {
                Items = products
                        .Select(product => ProductMapper.GetProductDto(product))
                        .ToList()
            });
        }
Esempio n. 3
0
        public async Task <ProductDto> GetAsync(Guid productId)
        {
            var product = await _productRepository.GetAsync(productId);

            var productDto = ProductMapper.GetProductDto(product);

            productDto.ProductOptions = product
                                        .ProductOptions
                                        .Select(productOption => ProductMapper.GetProductOptionDto(productOption))
                                        .ToList();

            return(productDto);
        }