Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Problem:
I'm trying to get data from sql server using linq and then verifying it. But it not getting data. I also write a function for sending data into sql server that store data.

My Controller
:
C#
private DB db = new DB(); //Database context

public ActionResult Index()
{
    return View();
}

[HttpGet]
public ActionResult Sign()
{
    return View();
}

[HttpPost]
public ActionResult Sign(Login l)
{
    var user = db.Logins.Where(s => s.Username == l.Username && s.Password == l.Password).FirstOrDefault();

    return RedirectToAction("check","Home");


}


What I have tried:

The main problem is that sign funtion(httppost) not getting data from sql server?
Posted
Updated 3-Aug-16 18:57pm
Comments
The Praveen Singh 4-Aug-16 0:59am    
is there any error occured ?
Muhammad Shan 6-Aug-16 3:04am    
no there is no error.

1 solution

try this:-
C#
var User=(from s in db.Logins select s where s.Username == l.Username && s.Password == l.Password).FirstOrDefault();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900