Linq with Two Table GroupBy sum column and row in asp.net co
my budget allocation example table is
Id Year Powerplant BudgetWorkOne BudgetWorkTwo 1 2017 p1 100 200
2 2017 p2 300 400
3 2018 p1 500 600
4 2018 p2 700 800
My usage budget table is
Id Year Powerplant BudgetCategory Usedamount
1 2017 p1 BudgetWorkOne 100
2 2017 p1 BudgetWorkTwo 150
3 2017 p2 BudgetWorkOne 500
4 2017 p2. BudgetWorkTwo 300
5 2018 p1 BudgetWorkOne 600
6 2018 p1 BudgetWorkTwo 500
7 2018 p2 BudgetWorkOne 200
8 2018 p2. BudgetWorkTwo 300
I want yearly with result groupby powerplant name.
Id year power AW1 UsedW1 DifW1 AW2 UsedW2 DifW2
1 2017 p1 100 100 0 200 150 50
2 2017 p2 300 500 -200 400 300 100
Columnsum 400 600 -200 600 450 150
How to create class and write for me.Please help me sirs.