Ejemplo n.º 1
0
        public ActionResult Login(cliente client)
        {
            using (salaoEntities db = new salaoEntities())
            {
                var cli = db.cliente.Single(c => c.Email == client.Email && c.Senha == client.Senha);
                if (cli != null)
                {
                    Session["IdCliente"] = cli.IdCliente.ToString();
                    Session["Email"]     = cli.Nome.ToString();

                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Email ou Senha Incorreto.");
                }
            }
            return(View());
        }