Reputation: 23
This is controller
public ActionResult login(login ob)
{
bool mm = db.regs.Any(model => model.username == ob.username && model.password.Equals(ob.password));
if (mm)
{
return RedirectToAction("welcome");
}
else
{
@ViewBag.err = "Invaid";
}
return View();
}
and the error in controller is
Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context.
Upvotes: 2
Views: 135
Reputation: 1
I think you should use ==
instead of .Equals()
So your code will be:
bool mm = db.regs.Any(model => model.username == ob.username
&& model.password == ob.password);
Upvotes: -1