public OrderDto GetOrder(int orderId) { var orderDto = orderDataService.GetOrder(orderId); var order = new OrderDto { ID = orderDto.ID, OrderRefNo = orderDto.OrderRefNo, BuyerId = orderDto.BuyerId, OrderedDate = orderDto.OrderedDate, ExpectedDiliveredDate = orderDto.ExpectedDiliveredDate, OrderType = orderDto.OrderType, DeliverySlotId = orderDto.DeliverySlotId, SupplierCategory = orderDto.SupplierCategory, IsDeleted = orderDto.IsDeleted, AssignmentSelectionType = orderDto.AssignmentSelectionType, Status = orderDto.Status, OrderDetails = orderDataService.GetOrderDetailsByOrder(orderDto.ID).Select(d => new OrderDetailDto { ID = d.ID, OrderID = orderDto.ID, StandardInventoryId = d.StandardInventoryId, Qty = d.Qty, OrderAssignments = orderDataService.GetOrderAssignmentsByOrderDetail(d.ID).Select(a => new OrderAssignmentDto { ID = a.ID, OrderDetailID = d.ID, SupplierInventoryID = a.SupplierInventoryID, Qty = a.Qty, SupplierAcknowledgement = a.SupplierAcknowledgement, VehicleAcknowledgement = a.VehicleAcknowledgement, BuyerAcknowledgement = a.BuyerAcknowledgement }) }).ToList() }; return(order); }