In my controller login I use the following code to make the user selection if it exists, however whenever the user types the incorrect name or password, an error because it does not find the result for .First
. I need to make a treatment, so when you do not find any results do not give this error.
var user = db.Usuario.First(u => u.Nome == model.Nome && u.Senha.Equals(model.Senha));