I have an requirement to get the records from table. I want to fetch data column from DB based on condition.
Suppose I have a grid which equally represents the table in database. This grid have a checkbox in header within each heading.
If checkbox corresponding to UserId is checked, I have to get "UserId" column like this
1
2
If user has also checked Name with it, now my list should also contain name with it like:
1 First
2 Second
and if the user clicks address also, I have to get address also.
The table/Grid is here:
UserId Name Address
----------------------------
1 First America
2 Second France
I tried with the following query but confused how can I concatenate more search columns with in single query like::
var ll = DB.Users.Select(d => d.Name).ToList();
Now, I have to introduce one more column in the above query. How can I do it?