Example #1
0
        public ShoppingCartItemDto PrepareShoppingCartItemDTO(ShoppingCartItem shoppingCartItem)
        {
            var dto = shoppingCartItem.ToDto();

            dto.ProductDto  = PrepareProductDTO(shoppingCartItem.Product);
            dto.CustomerDto = shoppingCartItem.Customer.ToCustomerForShoppingCartItemDto();
            dto.Attributes  = _productAttributeConverter.Parse(shoppingCartItem.AttributesXml);
            return(dto);
        }
Example #2
0
        public ShoppingCartItemDto PrepareShoppingCartItemDTO(ShoppingCartItem shoppingCartItem)
        {
            var dto = shoppingCartItem.ToDto();

            dto.ProductDto  = PrepareProductDTO(_productService.GetProductById(shoppingCartItem.ProductId));
            dto.CustomerDto = _customerService.GetCustomerById(shoppingCartItem.CustomerId).ToCustomerForShoppingCartItemDto();
            dto.Attributes  = _productAttributeConverter.Parse(shoppingCartItem.AttributesXml);
            return(dto);
        }
Example #3
0
        public async Task <ShoppingCartItemDto> PrepareShoppingCartItemDTOAsync(ShoppingCartItem shoppingCartItem)
        {
            var dto = shoppingCartItem.ToDto();

            dto.ProductDto = await PrepareProductDTOAsync(await _productService.GetProductByIdAsync(shoppingCartItem.ProductId));

            dto.CustomerDto = (await _customerService.GetCustomerByIdAsync(shoppingCartItem.CustomerId)).ToCustomerForShoppingCartItemDto();
            dto.Attributes  = _productAttributeConverter.Parse(shoppingCartItem.AttributesXml);
            return(dto);
        }
Example #4
0
        public OrderItemDto PrepareOrderItemDTO(OrderItem orderItem)
        {
            var dto = orderItem.ToDto();

            dto.Product    = PrepareProductDTO(orderItem.Product);
            dto.Attributes = _productAttributeConverter.Parse(orderItem.AttributesXml);
            return(dto);
        }