Мой код как показано ниже
GetDairyHeaderInfoByEmail(id)
.Where(p => p.ATTRIBUTE15 == id)
.Select(jk=> new {
jk.HEADER_ID_PK,
jk.VENDOR_ID,
jk.VENDOR_SITE_ID,
jk.VENDOR_NAME,
jk.ADDRESS_LINE1,
jk.ATTRIBUTE15
})
.GroupBy(p => p.HEADER_ID_PK)
.Select(p => new {
header_id_pk = p.Key,
invoice_id_pk = _ippDetailServices.GetDairyHeaderInfoByEmail(id).Where(k => k.HEADER_ID_PK == p.Key).Select(c => new { c.APP_INVOICES_ID_PK, c.INVOICE_TYPES, c.IS_HOURLY }).ToList() }).ToList();
Результаты, которые я вижу, как показано ниже
[{"header_id_pk": 800.0,
"invoice_id_pk": [
{
"APP_INVOICES_ID_PK": 1058.0,
"INVOICE_TYPES": "EPP",
"IS_HOURLY": "Y"
},
{
"APP_INVOICES_ID_PK": 1059.0,
"INVOICE_TYPES": "CPP",
"IS_HOURLY": "Y"
},
{
"APP_INVOICES_ID_PK": 1060.0,
"INVOICE_TYPES": "WHT ON DIVIDEND",
"IS_HOURLY": "N"
},
{
"APP_INVOICES_ID_PK": 1061.0,
"INVOICE_TYPES": "L.P",
"IS_HOURLY": "N"
}
] } ]
Но я хочу получить результаты, как показано ниже
[{
"header_id_pk": 800.0,
"HEADER_ID_PK" : 800.0,
"VENDOR_ID" : 12.0,
"VENDOR_SITE_ID" : 33.0,
"VENDOR_NAME" : Faisal,
"ADDRESS_LINE1" : XYZ address,
"invoice_id_pk": [
{
"APP_INVOICES_ID_PK": 1058.0,
"INVOICE_TYPES": "EPP",
"IS_HOURLY": "Y"
},
{
"APP_INVOICES_ID_PK": 1059.0,
"INVOICE_TYPES": "CPP",
"IS_HOURLY": "Y"
},
{
"APP_INVOICES_ID_PK": 1060.0,
"INVOICE_TYPES": "WHT ON DIVIDEND",
"IS_HOURLY": "N"
},
{
"APP_INVOICES_ID_PK": 1061.0,
"INVOICE_TYPES": "L.P",
"IS_HOURLY": "N"
}
] } ]
Извините за беспорядок, если таковые имеются, это мой первый вопрос.Спасибо