コード例 #1
0
        public ActionResult Login(LoginVM data)
        {
            TryValidateModel(data);
            if (ModelState.IsValid)
            {
                var user_ = System.Configuration.ConfigurationManager.AppSettings["user"];
                var pass_ = System.Configuration.ConfigurationManager.AppSettings["password"];

                if (!(data.Usuario == user_ && data.Contrasena == pass_))
                {
                    ModelState.AddModelError("Error", "El usuario y/o contraseña es invalido.");
                }
                else
                {
                    Session["usr_admin"] = data;
                    return RedirectToAction("Clientes","Administracion");
                }
            }
            return View();
        }
コード例 #2
0
 public ActionResult Login()
 {
     LoginVM data = new LoginVM();
     return View(data);
 }