How to put two conditions in a lambda expression

I have two Repeater Control options

var list = from i in DA.obm_view_studentLists where i.FranchiseID == FranchiseID && i.ExamDate == DateTime.Parse(this.pallavi.DropDownSelectedValue) select i;

I want to get the result in 1 go from the database.

this._approvedStudentList.DataSource = list.Select(e => e.ApprovedByOBM == true);

this._pendingStudentList.DataSource = list.Select(e => e.ApprovedByOBM == false);

I have a label field (UnPaidTotal) in the pendingStudentList repeater where I want to display the final board pending

I tried but failed

UnPaidTotal = string.Format("{0:c}", list.Select(e => e.ApprovedByOBM == true).Sum(j => j.CourseFee));
+3
source share
2 answers

Rate listto get all the results in one shot - just enclose from i in… select iin parentheses and add .ToList()to the end.

When installing DataSourcereplace list.Select(…onlist.Where(…

The same thing when receiving an unpaid amount - use Whereinstead Select.


, . , , , .

Select , Where . manufacturerList = carCollection.Select(car => car.Manufacturer);. , .

+2

, , , . , , IEnumerable/IQueryable, , . , .

, , IEnumerable , , . , .

- , , - . - , html , html . , .

+1

Source: https://habr.com/ru/post/1763377/


All Articles