public ActionResult _register(tbl_kullanici k)
 {
     if (ModelState.IsValid)
     {
         try
         {
             var varMi = db.kullanici.Where(x => x.kadi == k.kadi || x.eposta == k.eposta).FirstOrDefault();
             if (varMi == null)
             {
                 k.sifre      += "^#$½123456789";
                 k.sifre       = sifreIslemleri.convertMd5(k.sifre);
                 k.rolID       = 3;
                 k.kayitTarihi = DateTime.Now;
                 k.resimUrl    = "/assets/img/Profil/profilDefault.jpg";
                 k.durum       = true;
                 db.kullanici.Add(k);
                 db.SaveChanges();
                 Response.Redirect(Url.Action("login", "Account", new { mesaj = "Üyeliğiniz gerçekleşti.Şimdi Giriş Yapabilirsiniz." }));
             }
             else
             {
                 ModelState.AddModelError("_register", "Kullanıcı adı veya Eposta daha önce kullanılmış..");
             }
         }
         catch (Exception)
         {
             return(RedirectToAction("hata", "Home"));
         }
     }
     return(View());
 }
Beispiel #2
0
 public ActionResult EdKisiler([Bind(Include = "ID,kadi,resimUrl,tckn,sifre,ad,soyad,cinsiyet,dogumTarihi,cepTelefonu,evTelefonu,eposta,rolID,kayitTarihi,durum")] tbl_kullanici tbl_kullanici)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tbl_kullanici).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Admin"));
     }
     ViewBag.rolID = new SelectList(db.rol, "ID", "ad", tbl_kullanici.rolID);
     return(View(tbl_kullanici));
 }
Beispiel #3
0
        public ActionResult EdKisiler(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tbl_kullanici tbl_kullanici = db.kullanici.Find(id);

            if (tbl_kullanici == null)
            {
                return(HttpNotFound());
            }
            ViewBag.rolID = new SelectList(db.rol, "ID", "ad", tbl_kullanici.rolID);
            return(View(tbl_kullanici));
        }
        public ActionResult Register(RegisterModel registermodel)
        {
            RegisterModel model = new RegisterModel();


            // Kullanıcı kayıtlımı diye kontrol ediyorum.
            var user = (from x in db.tbl_kullanicis
                        where x.Eposta == registermodel.Eposta
                        select x).FirstOrDefault();

            if (user != null)
            {
                model.Error = "E-Posta zaten kullanılıyor. Lütfen Farklı bir E-Posta Adresi deneyiniz.";
            }
            else
            {
                // Kayıt Ediyoruz.
                tbl_kullanici yeniuser = new tbl_kullanici();
                yeniuser.Isim        = registermodel.Ad;
                yeniuser.Soyisim     = registermodel.Soyad;
                yeniuser.Sifre       = registermodel.Sifre;
                yeniuser.DogumTarihi = registermodel.DogumTarihi;
                yeniuser.Eposta      = registermodel.Eposta;
                yeniuser.FakulteIsim = registermodel.OkuduguFakulte;
                yeniuser.Hakkinda    = "";

                db.tbl_kullanicis.InsertOnSubmit(yeniuser);
                db.SubmitChanges();

                //Kullanıcı varsa session başlatıyorum.
                String[] GirisBilgileri = new String[2];
                GirisBilgileri[0] = yeniuser.Id.ToString();
                GirisBilgileri[1] = yeniuser.Isim + " " + yeniuser.Soyisim;
                Session["Giris"]  = GirisBilgileri;
                return(RedirectToAction("Index", "Home"));
            }
            return(View(model));
        }
        public ActionResult Profil(tbl_kullanici mdl)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("login", "Account"));
            }

            mdl.rolID       = 3;
            mdl.kayitTarihi = DateTime.Now;
            mdl.durum       = true;


            int id        = int.Parse(Session["user"].ToString());
            var kullanici = db.kullanici.Find(id);

            if (ModelState.IsValid)
            {
                try
                {
                    mdl.sifre += "^#$½123456789";
                    mdl.sifre  = sifreIslemleri.convertMd5(mdl.sifre);
                    string hata  = "";
                    bool   sonuc = true;
                    if (mdl.sifre != kullanici.sifre)
                    {
                        sonuc = false;
                        hata  = " Şifrenizi hatalı girdiniz";
                    }

                    if (sonuc == true && kullanici.kadi != mdl.kadi && db.kullanici.Where(x => x.kadi == mdl.kadi).Count() > 0)
                    {
                        sonuc = false;
                        hata  = " Kullanıcı adı zaten başka bir hesap tarafında kullanılmakta";
                    }

                    if (sonuc == true && kullanici.eposta != mdl.eposta && db.kullanici.Where(x => x.eposta == mdl.eposta).Count() > 0)
                    {
                        sonuc = false;
                        hata  = " Eposta zaten başka bir hesap tarafında kullanılmakta";
                    }

                    if (sonuc)
                    {
                        kullanici.ad          = mdl.ad;
                        kullanici.soyad       = mdl.soyad;
                        kullanici.eposta      = mdl.eposta;
                        kullanici.kadi        = mdl.kadi;
                        kullanici.tckn        = mdl.tckn;
                        kullanici.cepTelefonu = mdl.cepTelefonu;
                        kullanici.evTelefonu  = mdl.evTelefonu;

                        kullanici.cinsiyet    = mdl.cinsiyet;
                        kullanici.dogumTarihi = mdl.dogumTarihi;
                        db.SaveChanges();
                        ViewBag.Mesaj = "Başarıyla güncellendi.";
                    }
                    if (!sonuc)
                    {
                        ModelState.AddModelError("Profil", hata);
                    }
                }
                catch (Exception)
                {
                    return(RedirectToAction("mesaj", "Home", new { mesaj = "Üyelik sayfasında hatalar oluştu", link = "/Account/signup" }));
                }
            }
            return(View(kullanici));
        }