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

            var productDto = ProductMapper.GetProductDto(product);

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

            return(new Products()
            {
                Items = products
                        .Select(product => ProductMapper.GetProductDto(product))
                        .ToList()
            });
        }
Beispiel #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);
        }