public ActionResult Kaydol(LoginGirisView model)
        {
            if (ModelState.IsValid)
            {
                UserManager t = new UserManager();
                try
                {
                    t.UyeKayıt(model);
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);

                    return(View(model));
                }
                TempData["Model"] = "E-mail Adresinize Gönderilen Aktivasyon Kodunu Doğruladıktan Sonra Sisteme Giriş Yapabilirsiniz";

                return(RedirectToAction("Anasayfa"));
            }

            return(View(model));
        }
Ejemplo n.º 2
0
        public Uyeler UyeKayıt(LoginGirisView data)
        {
            //E-posta kontrolü
            BussinesLayerResult <Uyeler> repo = new BussinesLayerResult <Uyeler>();

            Uyeler kisi = uye.Listele().Find(x => x.Kullanici_EPosta == data.Kullanici_EPosta); //Kullanıcı E-mailleri eşleşiyormu Eşleşiyorsa bir kullanıcı dönecek bize

            if (kisi != null)                                                                   //belirtilen e-mail var ise hata mesajı yolla
            {
                throw new Exception("E-Posta adresi Zaten Var");
            }

            else
            {
                int sayı = uye.Ekle(new Uyeler
                {
                    Kullanici_Ad     = data.Kullanici_Ad,
                    Kullanici_EPosta = data.Kullanici_EPosta,
                    Kullanici_Sifre  = data.Kullanici_Sifre,
                    ActiveGuid       = Guid.NewGuid(),
                    IsActive         = false
                });

                if (sayı == 1) //Insert edilen kullanıcıları ekleme
                {
                    repo.Sonuc = uye.Listele().Find(x => x.Kullanici_EPosta == data.Kullanici_EPosta);
                }



                string gönderilecekkisi = data.Kullanici_EPosta;
                string Uri    = "http://localhost:60580";
                string Active = $"{Uri}/Anasayfa/UserActive/{repo.Sonuc.ActiveGuid}";
                string body   = $"Hesabını Aktifleştirmek için <a href='{Active}' target='_blank'>Tıklayınız</a> ";
                MailHelper.MailGönder(gönderilecekkisi, body, "Aktivasyon Kodu");//Aktivasyon kodunu gönderme
            }
            return(kisi);
        }