Hai friends,
I am beginner to MVC.
I have created registration.cshtml & login.cshtml.
How to check whether the user is valid user or invalid user?
In asp.net I used as:
select count(*) from Users where mailid=" " & password= " "
if it returns 0 i simply said user is invalid else valid user.
The same scenerio how to use in MVC with LINQ or Lambda Expression?
Please reply me what type of code I need to write?


Saineshwar BageriRank #115 · 19.6K reputationPosted Nov 20, 2014, 6:25 PM EST
int userId = (from u in db.Users
where u.mailid == EmailID && u.password = Password
select u.Id).firstOrDefault();
Mark as answer if i solved your issue
Sreekanth ReddyRank #726 · 3.2K reputationPosted Nov 21, 2014, 1:17 AM EST
Saineshwar BageriRank #115 · 19.6K reputationPosted Nov 21, 2014, 2:37 AM EST
which tell user is exists or not