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); }
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()); }