In my code I have two different lists. How could I join them for the above output. My code
Dim ec As List(Of InrBal) = New List(Of InrBal)()
If dt.Tables(0).Rows.Count > 0 Then
For i = 0 To dt.Tables(0).Rows.Count - 1
ec.Add(New InrBal() With {
.Income = Convert.ToInt32(dt.Tables(0).Rows(i)("Income"))
})
Next
End If
Dim eb As List(Of DashCoins) = New List(Of DashCoins)()
If dt.Tables(1).Rows.Count > 0 Then
For i = 0 To dt.Tables(1).Rows.Count - 1
eb.Add(New DashCoins() With {
.CoinName = dt.Tables(1).Rows(i)("CoinName").ToString,
.CoinBal = Convert.ToDecimal(dt.Tables(1).Rows(i)("CoinBal")),
.CoinPrice = Convert.ToDecimal(dt.Tables(1).Rows(i)("CoinPrice"))
})
Next
End If
Member
45 Points
429 Posts
Join 2 List in Web API
May 25, 2020 05:57 AM|ravininave|LINK
Hello I need this output
In my code I have two different lists. How could I join them for the above output. My code
Now I have to join this two list and send output.
All-Star
53741 Points
24068 Posts
Re: Join 2 List in Web API
May 25, 2020 10:08 AM|mgebhard|LINK
The community needs to know how income and coins are related. Otherwise, this question cannot be answered.
Member
45 Points
429 Posts
Re: Join 2 List in Web API
May 25, 2020 11:01 AM|ravininave|LINK
They both have different results. I am sending this from dataset.
All-Star
53741 Points
24068 Posts
Re: Join 2 List in Web API
May 25, 2020 11:31 AM|mgebhard|LINK
The Coin DataTable needs an IncomeId otherwise there is no way to join the two tables as described in the JSON data.
Member
45 Points
429 Posts
Re: Join 2 List in Web API
May 25, 2020 12:19 PM|ravininave|LINK
Okay done like this:
and I merged two Lists data and I got the above result
All-Star
53741 Points
24068 Posts
Re: Join 2 List in Web API
May 25, 2020 12:35 PM|mgebhard|LINK
The design only works if there is one income record in table 1 and all the records in table 2 relate to the single record in table 1.