public ActionResult Login(Models.Uye model) { model.UyeDetay.sifre = Encrypt(model.UyeDetay.sifre); var user = db.Uye.FirstOrDefault(m => m.UyeDetay.kullaniciAdi == model.UyeDetay.kullaniciAdi && m.UyeDetay.sifre == model.UyeDetay.sifre); if (user != null) { FormsAuthentication.SetAuthCookie(user.UyeDetay.kullaniciAdi, false); Session["Kullanici"] = user.UyeDetay.kullaniciAdi; Session["Oturum"] = "true"; Session["Yetki"] = user.Rol.rol1; Session["UyeID"] = user.uyeID; if (user.Rol.rol1 == "Admin") { ViewBag.GirisBilgisi = "OK"; TempData["GirisBilgisi"] = "OK"; return(RedirectToAction("Index", "Admin")); } else { ViewBag.GirisBilgisi = "OK"; TempData["GirisBilgisi"] = "OK"; return(RedirectToAction("Index", "Home")); } } else { ViewBag.mesaj = "Geçersiz Kullanıcı Adı veya Şifre"; return(View()); } }
public ActionResult Kaydet(string AdSoyad, string Email, string Telefon, string TC, string Sifre) { if (db.Uye.Any(w => w.Email == Email) == false) { Models.Uye uye = new Models.Uye(); uye.AdSoyad = AdSoyad; uye.Email = Email; uye.Telefon = Telefon; uye.TC = TC; uye.Sifre = Sifre; db.Uye.Add(uye); db.SaveChanges(); } return(View("UyeGiris")); }
public ActionResult Giris(string Email, string Sifre, string ReturnUrl) { Models.Uye uye = db.Uye.Where(w => w.Email == Email && w.Sifre == Sifre).FirstOrDefault(); if (uye != null) { string cookieValue = uye.ID + ";" + uye.Email + ";" + uye.AdSoyad; FormsAuthentication.SetAuthCookie(cookieValue, false); if (ReturnUrl != "") { return(Redirect(ReturnUrl)); } return(Redirect("~/")); } else { return(View("UyeGiris")); } }