Ejemplo n.º 1
0
        public ActionResult Index(AuthIndex form, string returnUrl)
        {
            var user = Database.Session.Query <Musteri>().FirstOrDefault(u => u.KullaniciAdi == form.Username);


            if (user == null || user.Parola != form.Password)
            {
                ModelState.AddModelError("Username", "Kullanıcı adı veya şifre geçersiz!");
            }

            if (!ModelState.IsValid)
            {
                return(View(form));
            }

            Session["Musteri"] = form.Username;

            if (!String.IsNullOrWhiteSpace(returnUrl))
            {
                return(Redirect(returnUrl));
            }
            else
            {
                Models.LoginState._LoginState = true;
                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult Login(AuthIndex form)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            else
            {
                var user = Database.Session.Query <Dersler>().FirstOrDefault(k => k.DersId == form.userId);


                return(RedirectToAction("Index", "Ogrenci"));
            }
        }