Esempio n. 1
0
        public async Task <ActionResult> Index(LoginModel model)
        {
            try
            {
                var            usuario    = model.NombreLogin;
                var            contrasena = model.Contrasena;
                RequestLoginBE ObjLogin   = new RequestLoginBE()
                {
                    DNI      = usuario,
                    Password = contrasena
                };
                var autenticar = await UsuarioPCL.Login(ObjLogin);

                if (autenticar.Code != 200)
                {
                    throw new Exception(autenticar.Message);
                }

                var sesion = new BaseModel();
                sesion.Usuario = autenticar.Data.response;

                Session[Sesiones.UsuarioLogin] = sesion;
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
        }
Esempio n. 2
0
        public async Task <ActionResult> Password(LoginModel model)
        {
            try
            {
                RequestLoginBE ObjLogin = new RequestLoginBE()
                {
                    Email = model.Correo
                };
                var notificar = await UsuarioPCL.NotificaLogin(ObjLogin);

                if (notificar.Code != 200)
                {
                    throw new Exception(notificar.Message);
                }
                ViewBag.Notifica = notificar.Data;
                return(View(model));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
        }