Exemplo n.º 1
0
        public static OrderDto ConvertToDto(Order m)
        {
            if (m == null)
            {
                return(new OrderDto());
            }

            var res = new OrderDto
            {
                Id           = m.Id,
                OrderCode    = m.OrderCode,
                Seller       = m.Seller,
                Customer     = m.Customer,
                OrderDate    = m.OrderDate,
                Customer1    = CustomerDto.ConvertToDto(m.Customer1),
                Employee     = EmployeeDto.ConvertToDto(m.Employee),
                OrderDetails = OrderDetailDto.ConvertToDto(m.OrderDetails),
                Payments     = PaymentDto.ConvertToDto(m.Payments)
            };

            return(res);
        }
Exemplo n.º 2
0
        public static IEnumerable <OrderDto> ConvertToDto(IEnumerable <Order> list)
        {
            if (list == null)
            {
                return(new List <OrderDto>());
            }

            var res = from m in list
                      select new OrderDto
            {
                Id           = m.Id,
                OrderCode    = m.OrderCode,
                Seller       = m.Seller,
                Customer     = m.Customer,
                OrderDate    = m.OrderDate,
                Customer1    = CustomerDto.ConvertToDto(m.Customer1),
                Employee     = EmployeeDto.ConvertToDto(m.Employee),
                OrderDetails = OrderDetailDto.ConvertToDto(m.OrderDetails),
                Payments     = PaymentDto.ConvertToDto(m.Payments)
            };

            return(res.ToList());
        }