示例#1
0
        public ActionResult Supervisor(SupervisorLogIn model)
        {
            var  response = new ResponseDTO <LoginResponseDTO>();
            var  caller   = new LoginCaller();
            bool redirect = false;

            try
            {
                if (ModelState.IsValid)
                {
                    response = caller.GetLogin(new UserDTO()
                    {
                        UserName = model.sUser, Password = model.sPassword
                    });
                    model.Message = (response.Success) ? string.Empty : response.Message;
                    redirect      = (response.Success && response.Result.IsAuthenticated) ? true : false;
                }
            }
            catch (System.Exception exception)
            {
                //Falta implementar el log **********
                model.Message = Key.GetError();
            }

            if (redirect)
            {
                SessionVar.SetLoginUser(response.Result);
                return(RedirectToAction("Administrator", "Menu"));
            }
            return(View(model));
        }
示例#2
0
 public void GetLogin()
 {
     InitializeTest();
     response = loginCaller.GetLogin(new UserDTO()
     {
         UserName = "******", Password = "******"
     });
     AssertsForLoginTest.AssertResponseOK(response);
 }