// GET: Home public ActionResult Index() { SinemaContext db = new SinemaContext(); List <Kullanici> kullanicilar = db.Kullanici.ToList(); return(View(kullanicilar)); }
public ActionResult SifremiUnuttum(string email) { SinemaContext db = new SinemaContext(); Kullanici k = db.Kullanici.Where(x => x.mail == email).SingleOrDefault(); if (k != null) { //string yeniSifre = new Random().Next(100000,999999).ToString(); //db.SaveChanges(); //string konu = "Şifre Hatırlatma"; //string mesaj = "Şifreniz: " + k.sifre; //Eposta.Gonder(k.mail,konu,mesaj); //ViewBag.Mesaj = "Epostanıza Şifreniz Gönderilmiştir."; Sifre s = new Sifre(); s.kullaniciID = k.kullaniciID; s.tarih = DateTime.Now; s.kod = Guid.NewGuid(); db.Sifre.Add(s); db.SaveChanges(); string konu = "Şifre Sıfırlama"; string mesaj = "Şifrenizi sıfırlamak için <a href='http://localhost:8811/Login/SifreSifirla?kod=" + s.kod + "'>tıklayınız"; Eposta.Gonder(konu, mesaj, k.mail); ViewBag.Mesaj = "Epostanıza Şifreniz Gönderilmiştir."; } else { ViewBag.Mesaj = "Böyle Bir Eposta Bulunamadı!"; } return(View()); }
public ActionResult UyeOl(Kullanici k) { Bilet bilet = new Bilet(); SinemaContext db = new SinemaContext(); Kullanici kul = db.Kullanici.Where(x => x.mail == k.mail).SingleOrDefault(); if (kul != null) { ViewBag.Hata = "Aynı eposta ile bir hesap var isterseniz şifremi unuttuma tıklayabilirsiniz."; return(View()); } else { if (k.yetkiID == null && k.resim == null) { k.resim = "kullanici.png"; k.yetkiID = 2; } db.Kullanici.Add(k); db.SaveChanges(); bilet.kullaniciID = k.kullaniciID; bilet.hediyebilet = 0; db.Bilet.Add(bilet); db.SaveChanges(); } ViewBag.Mesaj = "Hesabınız Başarı ile Oluşturuldu."; return(RedirectToAction("Index")); }
public ActionResult SifreSifirla(string kod) { SinemaContext db = new SinemaContext(); Sifre s = db.Sifre.Where(x => x.kod.ToString() == kod).SingleOrDefault(); if (s == null) { return(RedirectToAction("SifremiUnuttum")); } Kullanici k = db.Kullanici.Where(x => x.kullaniciID == s.kullaniciID).SingleOrDefault(); return(View(k)); }
private void Login_Load(object sender, EventArgs e) { FileStream fs = new FileStream(Application.LocalUserAppDataPath + "\\BiletFiyat.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite); StreamReader sr = new StreamReader(fs); string okunan = sr.ReadLine(); if (okunan == null) { StreamWriter sw = new StreamWriter(fs); sw.Write("12"); sw.Close(); } sr.Close(); Genel.BiletFiyatBelirleme(); using (SinemaContext ent = new SinemaContext()) { ent.Database.CreateIfNotExists(); User u = new User { Id = 1, UserName = "******", Name = "Serkan", SurName = "Karışan", IsActive = true, Password = "******", AddedDate = DateTime.Now, RoleId = 1 }; Role r1 = new Role { Id = 1, RoleName = "Admin", AddedDate = DateTime.Now, IsActive = true }; Role r2 = new Role { Id = 2, RoleName = "User", AddedDate = DateTime.Now, IsActive = true }; if (ent.Roles.Where(rl => rl.Id == r1.Id && rl.RoleName == r1.RoleName).FirstOrDefault() == null) { ent.Roles.Add(r1); ent.SaveChanges(); } if (ent.Roles.Where(rl => rl.Id == r2.Id && rl.RoleName == r2.RoleName).FirstOrDefault() == null) { ent.Roles.Add(r2); ent.SaveChanges(); } if (ent.Users.Where(us => us.Id == u.Id && us.UserName == u.UserName && us.Name == u.Name && us.SurName == u.SurName).FirstOrDefault() == null) { ent.Users.Add(u); ent.SaveChanges(); } } }
public ActionResult Index(string email, string sifre) { SinemaContext db = new SinemaContext(); Yetki y = new Yetki(); Kullanici k = db.Kullanici.Where(x => x.mail == email && x.sifre == sifre).SingleOrDefault(); if (k == null) { //bulanamadı ViewBag.Uyari = "Kullanici Bulunamadı!"; } else { //bulundu //eğer kullanıcı yönetici ise RedirectToAction --> Admin paneli else ana template Session["Kullanici"] = k; return(RedirectToAction("Index", "Home")); } return(View()); }
public ActionResult SifreSifirla(string yenisifre, string sifreonay, int kullaniciID) { SinemaContext db = new SinemaContext(); Kullanici k = db.Kullanici.Where(x => x.kullaniciID == kullaniciID).SingleOrDefault(); if (yenisifre != sifreonay) { ViewBag.Uyari = "Şifreler Eşleşmiyor Lütfen Kontrol Ediniz!"; return(View(k)); } else { if (sifreonay == k.sifre) { ViewBag.Uyari = "Şifre Eski Şifreniz ile Aynı Olamaz!"; return(View(k)); } k.sifre = sifreonay; db.SaveChanges(); return(RedirectToAction("Index")); } }
public BaseRepository() { _context = new SinemaContext(); _dbSet = _context.Set <T>(); }