i just started with Asp.net code 2.0 and migrating my code. and AsEnumerable() is not working in .Net Core.
my data is coming from table where
api_module
and
api_resource_name
are the columns
var result = ds.Tables[0].AsEnumerable().GroupBy(x => x.Field<string>("api_module")).Select(x => new { api_module = x.Key, api_resource_name = x.Where(z => z.Field<string>("api_resource_name") != null).Select(z => z.Field<string>("api_resource_name")).ToList() });
What I have tried:
i have tried using the for loop but could not able to solve my issue.
my required json format is
[
{
"api_module":"approvals",
"api_resource_name":[
]
},
{
"api_module":"bpsusers",
"api_resource_name":[
"alternateapproverfor",
"alternateapprovers"
]
},
{
"api_module":"commodities",
"api_resource_name":[
]
},
{
"api_module":"commoditygroups",
"api_resource_name":[
]
},
{
"api_module":"companies",
"api_resource_name":[
"addresses",
"bids",
"commitments",
"commodities",
"contacts",
"evaluations",
"financialinfo",
"interests",
"licenses",
"performanceratings",
"profisydocuments",
"profisyfolders",
"projectinterests",
"projects",
"qualifications",
"relationships",
"shopload"
]
},
{
"api_module":"costcodes",
"api_resource_name":[
]
},
{
"api_module":"currencies",
"api_resource_name":[
"rates"
]
},
{
"api_module":"dataexchangenew",
"api_resource_name":[
]
}
]