Modify LINQ query to accommodate search criteria
Anjali Agarwal
1,386
Reputation points
I have the following LINQ statement
var transaction = (from sst in Context.Transactions
join sstcnt in (
from ssti in _recorderContext.TransactionItems
group ssti by ssti.TransactionId into g
select new { TransactionId = g.Key, NumItemId = g.Count() }
) on sst.TransactionId equals sstcnt.TransactionId
join ssti in Context.TransactionItems on sst.TransactionId equals ssti.TransactionId
where ssti.TransactionId == trans.TransactionId
orderby sst.Created descending
select new object[]
{
sst.TransactionId,
sst.Status,
}
).ToList();
I have these 5 text boxes in my GUI:
FullName Trans# EmailAddress Phonenumber
If the employee only enters partial FullName and other text are either empty or full then I want to modify my LINQ query
to do the search on the data entered by the employee so for e.g. If the employee enters
peter for fullName
Trans# is empty
emialAddress is partial
Phone number is empty
then I want to do the search based on whatever data has been entered in the textboxes by the employee
if all the text boxes are empty except one of them is full then I want to do the search based on only the data that is entered in that text boxes. How can Modify my LINQ query to
do this kind of search