Ankit  Shukla

Ankit Shukla

  • NA
  • 681
  • 116.7k

Add where clause in LINQ query

Feb 25 2020 2:51 AM
Hello,
 
Requirement:  Need to get max SESSION_SRNO for particular LoginID
 
I have a method like this:
 
public long Get_Session_SrNo_Count(string userID)
{
HRMSContext Entities = this.HRMSRepository.Context as HRMSContext;
return Entities.t_login_info.ToList().Max(p => (long?)p.SESSION_SRNO).GetValueOrDefault();
 
I need to add where clause in this query.
Ex: where p.LoginID == userID
 
 
Please Help.
 
Thanks in advance.

Answers (2)