Example #1
0
        public ActionResult Login(LoginModel loginModel)
        {
            LoginModel logindetails = new LoginModel();

            using (var ibisaRepository = new IBISARepository())
            {
                logindetails = ibisaRepository.CheckLogin(loginModel);
            }
            if (logindetails != null)
            {
                FormsAuthentication.SetAuthCookie(logindetails.userName, false);
                Session["userID"]   = logindetails.userId;
                Session["userName"] = logindetails.userName;
                ViewBag.userId      = logindetails.userId;
                return(RedirectToAction("Workplace", "IBISAWatchers"));
            }
            else
            {
                ViewBag.FailedLogin = "******";
                return(View());
            }
        }