RadhaKrishnaKiJaya
asked on
Need help with a LINQ type query
Hi Experts,
I have this query. (I am sorry, I don't know what type of query is this)
This query returns all the records for that user. But I want only the latest record for todays date. I want something like this If I would do in SQL.
I have this query. (I am sorry, I don't know what type of query is this)
var MemberRecentSignIn = _MemberFailedSignInRepository.Get(x => x.UserName == UserName);
This query returns all the records for that user. But I want only the latest record for todays date. I want something like this If I would do in SQL.
SELECT TOP (1) [ID],[UserName],[LockCounter],[LockFlag],[Created]
FROM MemberFailedSignIns where
Created >= DATEADD(DAY, 0, DATEDIFF(DAY, 0, CURRENT_TIMESTAMP))
AND Created < DATEADD(DAY, 1, DATEDIFF(DAY, 0, CURRENT_TIMESTAMP))order by created desc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No worries. Glad I could help
ASKER
Thank you so much for your wonderful help. I had to change little bit to make it work. Instead of "get" used "Fetch" method.
var MemberRecentSignIn = _MemberFailedSignInReposit
Thank you again!