public GetRouteListsDetailsResponseDto Get([FromBody] int[] routeListsIds)
        {
            var tokenStr = Request.Headers[HeaderNames.Authorization];

            _logger.LogInformation($"(RouteListIds: {string.Join(',', routeListsIds)}) User token: {tokenStr}");

            var routeLists = _aPIRouteListData.Get(routeListsIds);
            var ordersIds  = routeLists.Where(x => x.CompletionStatus == RouteListDtoCompletionStatus.Incompleted)
                             .SelectMany(x => x.IncompletedRouteList.RouteListAddresses.Select(x => x.OrderId));

            var orders = _aPIOrderData.Get(ordersIds.ToArray());

            var resortedOrders = new List <OrderDto>();

            foreach (var orderId in ordersIds)
            {
                resortedOrders.Add(orders.Where(o => o.OrderId == orderId).First());
            }

            return(new GetRouteListsDetailsResponseDto()
            {
                RouteLists = routeLists,
                Orders = resortedOrders
            });
        }
        public OrderDto Get(int orderId)
        {
            var tokenStr = Request.Headers[HeaderNames.Authorization];

            _logger.LogInformation($"(orderId: {orderId}) User token: {tokenStr}");

            return(_aPIOrderData.Get(orderId));
        }
Пример #3
0
        public GetRouteListsDetailsResponseDto Get([FromBody] int[] routeListsIds)
        {
            var routeLists = _aPIRouteListData.Get(routeListsIds);
            var ordersIds  = routeLists.Where(x => x.CompletionStatus == RouteListDtoCompletionStatus.Incompleted)
                             .SelectMany(x => x.IncompletedRouteList.RouteListAddresses.Select(x => x.OrderId));

            var orders = _aPIOrderData.Get(ordersIds.ToArray());

            var resortedOrders = new List <OrderDto>();

            foreach (var orderId in ordersIds)
            {
                resortedOrders.Add(orders.Where(o => o.OrderId == orderId).First());
            }

            return(new GetRouteListsDetailsResponseDto()
            {
                RouteLists = routeLists,
                Orders = resortedOrders
            });
        }
Пример #4
0
 public OrderDto Get(int orderId)
 {
     return(_aPIOrderData.Get(orderId));
 }