Here is my repository method which returns UserId
,
public IQueryable<int> getLoginStatus(string emailId, string password)
{
return (from r in taxidb.Registrations
where (r.EmailId == emailId && r.Password == password)
select r.UserId);
}
How to return UserName
which is a string along with UserId
... Any suggestion?
EDIT:
I tried this it is working but how to get whether the query result contains records or not,
public RegistrationBO getLoginStatus(string emailId, string password)
{
return (from r in taxidb.Registrations
where (r.EmailId == emailId && r.Password == password)
select new RegistrationBO()
{
UserId = r.UserId,
UserName = r.UserName
}).FirstOrDefault();
}