У меня есть один список.
var result = (from cab in cabinets
join mod in modemsCount on cab.OrganizationID equals mod.OrganizationID into modCount
from modcount in modCount.DefaultIfEmpty()
join objectc in objectCount on cab.OrganizationID equals objectc.OrganizationID into objectcCount
from objectccount in objectcCount.DefaultIfEmpty()
join modActive in modemsActiveCount on cab.OrganizationID equals modActive.OrganizationID into modActiveCount
from modActivecount in modActiveCount.DefaultIfEmpty()
join device in deviceCount on cab.OrganizationID equals device.OrganizationID into devCount
from devcount in devCount.DefaultIfEmpty()
join deviceActive in deviceActiveCount on cab.OrganizationID equals deviceActive.OrganizationID into devActiveCount
from devActivecount in devActiveCount.DefaultIfEmpty()
join regul in regulCount on cab.OrganizationID equals regul.OrganizationID into RegulCount
from Regulcount in RegulCount.DefaultIfEmpty()
join regulActive in regulActiveCount on cab.OrganizationID equals regulActive.OrganizationID into RegulactiveCount
from RegulActivecount in RegulactiveCount.DefaultIfEmpty()
join TVC in TVCount on cab.OrganizationID equals TVC.OrganizationID into TVCCount
from TVCcount in TVCCount.DefaultIfEmpty()
join TVAC in TVActiveCount on cab.OrganizationID equals TVAC.OrganizationID into TVACCount
from TVACcount in TVACCount.DefaultIfEmpty()
join ContourC in ContourCount on cab.OrganizationID equals ContourC.OrganizationID into CONTOURCount
from CONTOURcount in CONTOURCount.DefaultIfEmpty()
join ContourActiveC in ContourActiveCount on cab.OrganizationID equals ContourActiveC.OrganizationID into CONTOURActiveCount
from CONTOURActivecount in CONTOURActiveCount.DefaultIfEmpty()
join userC in userCount on cab.OrganizationID equals userC.OrganizationID into userCCount
from userCcount in userCCount.DefaultIfEmpty()
join userAC in userActiveCount on cab.OrganizationID equals userAC.OrganizationID into userACCount
from userACcount in userACCount.DefaultIfEmpty()
join userWeb in userwebcabCount on cab.OrganizationID equals userWeb.OrganizationID into userWebCount
from userWebcount in userWebCount.DefaultIfEmpty()
select new
{
OrganizationID = cab.OrganizationID,
CabinetName = cab.CabinetName,
CabinetURL = cab.CabinetURL,
ModemCount = modcount?.NumberOfRecords ?? 0,
ObjectCount = objectccount?.NumberOfRecords ?? 0,
ModemActiveCount = modActivecount?.NumberOfRecords ?? 0,
DeviceCount = devcount?.NumberOfRecords ?? 0,
DeviceActiveCount = devActivecount?.NumberOfRecords ?? 0,
RegulatorCount = Regulcount?.NumberOfRecords ?? 0,
RegulatorActiveCount = RegulActivecount?.NumberOfRecords ?? 0,
TVCount = TVCcount?.NumberOfRecords ?? 0,
TVActiveCount = TVACcount?.NumberOfRecords ?? 0,
ContourCount = CONTOURcount?.NumberOfRecords ?? 0,
ContourActiveCount = CONTOURActivecount?.NumberOfRecords ?? 0,
UserCount = userCcount?.NumberOfRecords ?? 0,
UserActiveCount = userACcount?.NumberOfRecords ?? 0,
UserMobileCount = userWebcount?.NumberOfRecords ?? 0
}).ToList();
Мне нужно обьединить его с другой коллекцией, но та является уже массивом массивов:
var urls = result.Select(a => a.CabinetURL).Distinct().ToList();
List<JObject> jsonDataList = new List<JObject>();
for (int i = 0; i < 30; i++)
{
string jsonData = org.GetDataHttp(urls[i], 1, 250); // Получение сделок компании по ссылке
if (string.IsNullOrEmpty(jsonData)) { Console.WriteLine($@"{i}, continue"); continue; } // Если такой ссылки нету в амосрм - continue
JObject z = JObject.Parse(jsonData);
z["_embedded"]["url"] = urls[i]; // Добавление искомой ссылки в результат для дальнейшего джойна
Console.WriteLine($@"Data finded at index {i}");
jsonDataList.Add(z);
}
List<ICollection> leadData_List = new List<ICollection>();
for (int i = 0; i < jsonDataList.Count; i++)
{
var lead = jsonDataList[i];
var url = lead["_embedded"]["url"];
var leadData = lead["_embedded"]["leads"].Select(a => new
{
id = (int)a["id"],
name = (string)a["name"],
url = url
}).ToList().ToList();
}
Мне необходимо обьединить эти две коллекции по ключу URL. Пробовал циклом, выцепляя списки по одному, и выводя в переменную, и просто по индексу - не получилось. Может что не так сделал.
Есть какие то способы решить данную проблему?