Esempio n. 1
0
        public ActionResult Login(LoginViewModel model)
        {
            Personal  personal  = _personalService.GetPersonalByLogin(model.EMail, model.Password);
            Corporate corporate = _corporateService.GetCorporateByLogin(model.EMail, model.Password);

            if (personal != null)
            {
                Session["personalID"] = personal.ID;

                if (personal.UserRoleID == 1)
                {
                    return(RedirectToAction("Home", "Admin"));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            else if (corporate != null)
            {
                Session["corporateID"] = corporate.ID;
                return(RedirectToAction("CorparateProfil", "Corporate"));
            }
            else
            {
                ViewBag.Message = "!!Hatalı giriş yaptınız.Tekrar deneyin.";
            }
            return(View());
        }
Esempio n. 2
0
        public ActionResult Login(LoginViewModel model, string Remember)
        {
            Personal  personal  = _personalService.GetPersonalByLogin(model.EMail, model.Password);
            Corporate corporate = _corporateService.GetCorporateByLogin(model.EMail, model.Password);

            if (personal != null)
            {
                Session["personal"]   = personal;
                Session["personalID"] = personal.ID;
                if (Remember == "on")
                {
                    FormsAuthentication.RedirectFromLoginPage(model.EMail, true);
                }
                else
                {
                    FormsAuthentication.RedirectFromLoginPage(model.EMail, false);
                }
                if (personal.UserRoleID == 1)
                {
                    return(RedirectToAction("ListPersonal", "Admin"));
                }
                else
                {
                    return(RedirectToAction("Profil", "PersonalProfil", new { id = personal.ID }));
                }
            }
            else if (corporate != null)
            {
                Session["corporate"] = corporate;
                return(RedirectToAction("CorparateProfil", "Corporate"));
            }
            else
            {
                ViewBag.Message = "!!Hatalı giriş yaptınız.Tekrar deneyin.";
            }
            return(View());
        }