Esempio n. 1
0
        private OrderDetailsDto MapToOrderDetailsDto(
            Dtos.CustomerDetailsDto customerDto,
            Order order,
            List <OrderItem> orderItems)
        {
            var orderDetailsDto = new OrderDetailsDto();
            var orderDto        = new OrderDto();

            orderDetailsDto.Customer = new CustomerDto()
            {
                FirstName = customerDto.FirstName,
                LastName  = customerDto.LastName
            };

            if (order != null)
            {
                orderDto = new OrderDto()
                {
                    DeliveryAddress  = GetDeliveryAddress(customerDto),
                    OrderNumber      = order.OrderId,
                    OrderItems       = GetOrderItems(orderItems, order.ContainsGift),
                    DeliveryExpected = order.DeliveryExpected.ToString("dd-MMMM-yyyy"),
                    OrderDate        = order.OrderDate.ToString("dd-MMMM-yyyy"),
                };
            }

            orderDetailsDto.Order = orderDto;

            return(orderDetailsDto);
        }
Esempio n. 2
0
 private string GetDeliveryAddress(Dtos.CustomerDetailsDto customerDto)
 {
     //"deliveryAddress": "1A Uppingham Gate, Uppingham, LE15 9NY",
     return($"{customerDto.HouseNumber} {customerDto.Street}, {customerDto.Town}, {customerDto.Postcode}");
 }