How to compare the data in sqlServer using WCF with MVC ?!!

Dec 19 2018 7:22 PM
 i can't read from database then compare this string with the parameter of certain function
i'm using ASP.net MVC4 
i tried that i create WCF as following :
 
public int login_service (string username, string password)
{
OnlineFoodOrderingEntities user1 = new OnlineFoodOrderingEntities();
var x = from n in user1.users select n;
List tst= x.ToList();
if (tst[0].username == username && tst[0].password == password )
{
return 1;
}
else{ 
return 0;
}
 }
then in MVC application 
 
public ActionResult Login(string username, string password)
{
ServiceReference1.ServiceClient sc = new ServiceReference1.ServiceClient();
int check = sc.login_service(username,password);
if ( check == 1)
{
return RedirectToAction("cuisine", "Home");
}
else
{
return View();
}
 
the database is called OnlineFoodOrdering 
and the table is called user 
i want when the check variable is equle to "1" it redirect to Home/cuisine.
please any help 
thanks in advance  
 

Answers (1)