コード例 #1
0
        public List <XMProductAddCount> GetXMProductByIDsCount(List <int> IDs, int CombinationID)
        {
            var query = from info in this._context.XMProducts
                        join count in this._context.XMProductCombinations
                        on info.Id equals count.ProductID into Counts
                        from counts in Counts.DefaultIfEmpty()
                        where info.IsEnable == false &&
                        counts.IsEnabled == false &&
                        IDs.Contains(info.Id) &&
                        counts.CombinationID == CombinationID
                        select new XMProductAddCount
            {
                Id                     = info.Id,
                BrandTypeId            = info.BrandTypeId,
                ProductName            = info.ProductName,
                ManufacturersCode      = info.ManufacturersCode,
                Specifications         = info.Specifications,
                ManufacturersInventory = info.ManufacturersInventory,
                WarningQuantity        = info.WarningQuantity,
                ProductColors          = info.ProductColors,
                ProductUnit            = info.ProductUnit,
                ProductWeight          = info.ProductWeight,
                ProductVolume          = info.ProductVolume,
                IsPremiums             = info.IsPremiums,
                Count                  = counts.Count,
                IsEnable               = info.IsEnable,
                CreateID               = info.CreateID,
                CreateDate             = info.CreateDate,
                UpdateID               = info.UpdateID,
                UpdateDate             = info.UpdateDate
            };

            return(query.ToList());
        }