Beispiel #1
0
        public ActionResult Login(LoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                Kullanici user = _kullaniciService.GetUserByLogin(model.Mail, model.Password);
                if (user != null)
                {
                    if (user.Rol.RolAdi == "Admin")
                    {
                        Session["kullanici"] = user;
                        return(RedirectToAction("Index", "Admin", new { id = user.KullaniciId }));
                    }
                    else if (user.Rol.RolAdi == "Uye")
                    {
                        Session["kullanici"] = user;
                        return(RedirectToAction("Index", "Home", new { id = user.KullaniciId }));
                    }
                }
                else
                {
                    ViewBag.Hata = "Giriş bilgileri hatalı";
                }
            }

            return(View());
        }