Esempio n. 1
0
        public ActionResult Register(UserViewModel model)
        {
            Kullanici user = new Kullanici();

            user.Adi         = model.Name;
            user.Soyadi      = model.Surname;
            user.Mail        = model.Mail;
            user.Telefon     = model.Telefon;
            user.Sifre       = model.Password;
            user.Adres       = model.Adres;
            user.DogumTarihi = model.BirthDate;
            user.IsActive    = true;//Sonradan eğiştirelecek
            user.RoleID      = 3;


            try
            {
                bool result = _kullaniciService.Add(user);
                if (result)
                {
                    result = MailHelper.SendMail(user);
                }

                return(RedirectToAction("Login"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
            }

            return(View());
        }
 public IActionResult Ekle(Kullanici kullanici)
 {
     try
     {
         _kullaniciService.Add(kullanici);
         return(Ok());
     }
     catch (Exception)
     {
         return(BadRequest(kullanici));
     }
 }
 //[Httppost]
 // /api/Kullanici
 public IHttpActionResult Post(KullaniciModel model)
 {
     try
     {
         model.CreatedBy = User.Identity.Name;
         if (ModelState.IsValid)
         {
             _kullaniciService.Add(model);
             return(Ok());
         }
         return(BadRequest());
     }
     catch (Exception exc)
     {
         return(InternalServerError());
     }
 }
Esempio n. 4
0
        public IActionResult KullaniciKaydet(Kullanici kullanici)
        {
            Kullanici kul = _kullaniciService.GetById(kullanici.Id);


            if (kul != null)
            {
                kul.Ad    = kullanici.Ad;
                kul.Soyad = kullanici.Soyad;
                _kullaniciService.Update(kul);
            }
            else
            {
                _kullaniciService.Add(kullanici);
            }

            return(Ok(true));
        }
Esempio n. 5
0
        public IActionResult KayitOl(string kulAdi, string sifre, string email)
        {
            Kullanici kul = _kullaniciService.GetKullaniciKontrol(kulAdi, email);

            if (kul == null)
            {
                kul = new Kullanici();
                kul.KullaniciAdi = kulAdi;
                kul.Sifre        = sifre;
                kul.Eposta       = email;
                _kullaniciService.Add(kul);

                return(Json(true));
            }
            else
            {
                return(Json(false));
            }
        }
Esempio n. 6
0
        public IDataResult <Kullanici> Register(KullaniciKayitDto kullaniciKayitDto, string password)
        {
            byte[] passwordHash, passwordSalt;
            HashingHelper.CreatePasswordHash(password, out passwordHash, out passwordSalt);
            var user = new Kullanici
            {
                Email        = kullaniciKayitDto.Email,
                TC           = kullaniciKayitDto.TC,
                Adi          = kullaniciKayitDto.Adi,
                Soyadi       = kullaniciKayitDto.Soyadi,
                PasswordHash = passwordHash,
                PasswordSalt = passwordSalt,
                Status       = true,
                Adres        = kullaniciKayitDto.Adres,
            };

            _kullaniciService.Add(user);
            return(new SuccessDataResult <Kullanici>(user, "Kayıt oldu"));
        }
 //[HttpPost]
 // /api/Kullanici
 //public IHttpActionResult Post(KullaniciModel model)
 //{
 //    try
 //    {
 //        model.CreatedBy = User.Identity.Name;
 //        if (ModelState.IsValid)
 //        {
 //            _kullaniciService.Add(model);
 //            return Ok(model);
 //        }
 //        return BadRequest(ModelState);
 //    }
 //    catch (Exception exc)
 //    {
 //        return InternalServerError();
 //    }
 //}
 public IHttpActionResult PostKullanici(KullaniciModel model)
 {
     try
     {
         model.CreatedBy = User.Identity.Name;
         if (ModelState.IsValid)
         {
             _kullaniciService.Add(model);
             return(Ok(model));
         }
         //return BadRequest(); // ModelState parametresi modeldeki data annotation'lar olarak tanımlanan
         // validasyon hatalarını geliştiriciye dönmemizi sağlar
         return(BadRequest(ModelState));
     }
     catch (Exception exc)
     {
         return(InternalServerError());
     }
 }
Esempio n. 8
0
 private void btnEkleKullaniciYeni_Click(object sender, EventArgs e)
 {
     if (_kullaniciService.GetKullaniciByName(tbxKullaniciAdi.Text) == null && tbxKullaniciAdi.Text != string.Empty)
     {
         Roles role = Roles.normal;
         if (cbxAdminMi.Checked)
         {
             role = Roles.admin;
         }
         _kullaniciService.Add(new Kullanici
         {
             KullaniciAdi = tbxKullaniciAdi.Text,
             Password     = tbxParola.Text,
             isGecerli    = true,
             Role         = role
         });
         MessageBox.Show("Kullanıcı Eklendi");
     }
     else
     {
         MessageBox.Show("Kullanıcı Ekleme Başarısız");
     }
     LoadDGWKullanici();
 }
Esempio n. 9
0
 public ActionResult Kaydet(Kullanici kullanici)
 {
     return(View(KullaniciService.Add(kullanici)));
 }