コード例 #1
0
        public async Task <IEnumerable <ActiveOrderModel> > ActiveOrders()
        {
            var client = await _clientInfo.ClientInfoAll();

            var orderColorActive = await _orderServices.OrderColor();

            List <ActiveOrderModel> activeOrders = new List <ActiveOrderModel>();

            foreach (var item in orderColorActive)
            {
                activeOrders.Add(new ActiveOrderModel
                {
                    IdOrder       = item.Id,
                    StatusOrder   = item.StatusOrder1.StatusOrder1,
                    PaymentState  = item.PaymentState1.PaymentState1,
                    OrderDate     = item.OrderDate,
                    ClosingData   = item.ClosingData,
                    DiscountPrice = item.DiscountPrice,
                    Id            = ClientId(item)
                });
            }

            var joinTable = (from t1 in client
                             join t2 in activeOrders on t1.Id equals t2.Id
                             select new ActiveOrderModel()
            {
                Id = t1.Id,
                Name = $"{t1.Surname } {t1.Name} {t1.PatronymicName}",
                Phone = t1.Phone,
                IdOrder = t2.IdOrder,
                StatusOrder = t2.StatusOrder,
                PaymentState = t2.PaymentState,
                OrderDate = t2.OrderDate,
                ClosingData = t2.ClosingData,
                DiscountPrice = t2.DiscountPrice,
            });

            return(joinTable);
        }