I am not expert in Linq or Lambda i really need help with this query.
This is like Statement of Account it has debit, credit and balance. however my linq query is wrong i got this result when im executing this query...
result:
suppose the result is this.
here's my code:
decimal Balance = 0;
var result = from a in entities.Payments
where a.StudentID == ParamStudentID
select new
{
Date = a.DateAdded,
Code = entities.Particulars.Where(p => p.Name == a.PaymentDes).Select(sp => sp.Code).FirstOrDefault(),
Particulars = a.PaymentDes,
Debit = 0,
Credit = a.Amount,
Balance = Balance + a.Amount,
SyTerm = a.SchoolYear + "-" + a.Term.Trim().Substring(0, 5)
};
i know this is an easy question but i don't know how to solve. :D anyone can help me.