public ActionResult KayitOl(KayitModal model)
 {
     if (ModelState.IsValid)
     {
         KullaniciYonet           ky         = new KullaniciYonet();
         BLHatalar <Kullanicilar> kayitsonuc = ky.KullaniciKayit(model);
         if (kayitsonuc.Hata.Count > 0)
         {
             kayitsonuc.Hata.ForEach(x => ModelState.AddModelError("", x));
             return(View(model));
         }
     }
     return(View());
 }
Пример #2
0
        public BLHatalar <Kullanicilar> KullaniciKayit(KayitModal model)
        {
            // Kullanıcı username kontrolü..
            // Kullanıcı e-posta kontrolü..


            Kullanicilar kullanici = rep_kul.Find(x => x.KullaniciAd == model.KullaniciAd || x.Email == model.EMail);

            if (kullanici != null)
            {
                if (kullanici.KullaniciAd == model.KullaniciAd)
                {
                    kullaniciSonuc.Hata.Add("Kullanıcı adı kayıtlı.");
                }
                if (kullanici.Email == model.EMail)
                {
                    kullaniciSonuc.Hata.Add("Kullanıcı mail adresi kayıtlı.");
                }
            }
            else
            {
                // Kayıt işlemi..
                //Aktivasyon e-postası gönderimi.
                int kayit = rep_kul.Insert(new Kullanicilar()
                {
                    KullaniciAd = model.KullaniciAd,
                    Email       = model.EMail,
                    Sifre       = model.Sifre,
                    //OlusturmaTarihi=DateTime.Now,
                    //DegistirmeTarihi = DateTime.Now,
                    //DegistirenKullanici = "gulaysenturk",
                    Aktif     = false,
                    AktifGuid = Guid.NewGuid(),
                    Adminmi   = false
                });
                if (kayit > 0)
                {
                    kullaniciSonuc.sonuc = rep_kul.Find(x => x.KullaniciAd == model.KullaniciAd || x.Email == model.EMail);
                }
            }
            return(kullaniciSonuc);
        }