示例#1
0
        private void btnloguin_Click(object sender, EventArgs e)
        {
            acceder = new logueo();
            acceder.SetUsuario(txtusu.Text);
            acceder.setPassword(txtcontra.Text);

            loguinlogica = new loguinLogica(acceder);
            loguinlogica.ValidarUsuario();
        }
 public ActionResult Login(logueo user)
 {
     using (BD_BelaaEntities bd = new BD_BelaaEntities())
     {
         var usr = bd.logueo.Where(u => u.usuario == user.usuario && u.clave == user.clave).FirstOrDefault();
         if (usr != null)
         {
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             ModelState.AddModelError("", "Usuario o contraseña incorrecta.");
         }
         return(View());
     }
 }