Пример #1
0
        public ActionResult Ayarlar(Kullanici kullanici, HttpPostedFileBase dosya)
        {
            VMKullaniciVeAlert vm = new VMKullaniciVeAlert();
            var kul = db.Kullanici.FirstOrDefault(m => m.Kadi == User.Identity.Name);

            if (ModelState.IsValid)
            {
                if (dosya != null)
                {
                    UserHelpers.FotografSil(kul.Foto);
                    kul.Foto = UserHelpers.FotografYukle(dosya);
                }
                kul.AdSoyad = kullanici.AdSoyad;
                kul.Email   = kullanici.Email;

                if (!string.IsNullOrEmpty(kullanici.Sifre))
                {
                    kul.Sifre = kullanici.Sifre;
                }

                vm.Alert = new VMAlert("success", Resources.Dil.basariliguncelleme);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                vm.Alert = new VMAlert("danger", Resources.Dil.formukontrolet);
            }
            return(View(vm));
        }
Пример #2
0
        public ActionResult Ayarlar()
        {
            VMKullaniciVeAlert vm = new VMKullaniciVeAlert();

            vm.Kullanici = db.Kullanici.FirstOrDefault(m => m.Kadi == User.Identity.Name);
            return(View(vm));
        }
Пример #3
0
        public ActionResult Giris(Kullanici kullanici)
        {
            var bak = db.Kullanici.FirstOrDefault(m => m.Kadi == kullanici.Kadi && m.Sifre == kullanici.Sifre);

            if (bak != null)
            {
                FormsAuthentication.SetAuthCookie(bak.Kadi, false);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                VMKullaniciVeAlert vm = new VMKullaniciVeAlert();
                vm.Alert = new VMAlert("danger", Resources.Dil.kuladisifrehatali);
                return(View(vm));
            }
        }
Пример #4
0
        // GET: Admin/Kullanici/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            VMKullaniciVeAlert vm = new VMKullaniciVeAlert()
            {
                Kullanici = db.Kullanici.Find(id)
            };

            if (vm.Kullanici == null)
            {
                return(HttpNotFound());
            }
            return(View(vm));
        }
Пример #5
0
 public ActionResult Create([Bind(Include = "Kid,Kadi,Sifre,AdSoyad,Email,UyelikTarihi,Foto,Yetki")] Kullanici kullanici, HttpPostedFileBase dosya)
 {
     if (ModelState.IsValid)
     {
         var bak = db.Kullanici.FirstOrDefault(m => m.Kadi == kullanici.Kadi);
         if (!UserHelpers.KullaniciAdiKontrolu(kullanici.Kadi) || bak != null)
         {
             VMKullaniciVeAlert kullaniciVeAlert = new VMKullaniciVeAlert()
             {
                 Alert = new VMAlert("danger", Resources.Dil.gecersizkul)
             };
             return(View(kullaniciVeAlert));
         }
         else if (string.IsNullOrEmpty(kullanici.Sifre))
         {
             VMKullaniciVeAlert kullaniciVeAlert = new VMKullaniciVeAlert()
             {
                 Alert = new VMAlert("danger", Resources.Dil.sifregir)
             };
             return(View(kullaniciVeAlert));
         }
         string foto = UserHelpers.FotografYukle(dosya);
         kullanici.Foto         = foto;
         kullanici.UyelikTarihi = DateTime.Now;
         db.Kullanici.Add(kullanici);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         VMKullaniciVeAlert kullaniciVeAlert2 = new VMKullaniciVeAlert()
         {
             Alert = new VMAlert("danger", Resources.Dil.formukontrolet)
         };
         return(View(kullaniciVeAlert2));
     }
 }
Пример #6
0
        public ActionResult Kayit(Kullanici kullanici)
        {
            var bak = db.Kullanici.FirstOrDefault(m => m.Kadi == kullanici.Kadi);

            if (bak != null)
            {
                VMKullaniciVeAlert vm = new VMKullaniciVeAlert()
                {
                    Alert = new VMAlert("danger", Resources.Dil.gecersizkul)
                };
                return(View(vm));
            }
            else
            {
                kullanici.Foto         = "/Content/Uploads/noimg.png";
                kullanici.Yetki        = "u";
                kullanici.UyelikTarihi = DateTime.Now;
                db.Kullanici.Add(kullanici);
                db.SaveChanges();

                FormsAuthentication.SetAuthCookie(kullanici.Kadi, false);
                return(RedirectToAction("Index", "Home"));
            }
        }
Пример #7
0
        public ActionResult Edit([Bind(Include = "Kid,Kadi,Sifre,AdSoyad,Email,UyelikTarihi,Foto,Yetki")] Kullanici kullanici, HttpPostedFileBase dosya)
        {
            VMKullaniciVeAlert vm = new VMKullaniciVeAlert();

            if (ModelState.IsValid)
            {
                var kul = db.Kullanici.Find(kullanici.Kid);
                if (kul == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                if (dosya != null)
                {
                    UserHelpers.FotografSil(kul.Foto);
                    kul.Foto = UserHelpers.FotografYukle(dosya);
                }
                kul.AdSoyad = kullanici.AdSoyad;
                kul.Email   = kullanici.Email;
                kul.Yetki   = kullanici.Yetki;

                if (!string.IsNullOrEmpty(kullanici.Sifre))
                {
                    kul.Sifre = kullanici.Sifre;
                }

                vm.Alert = new VMAlert("success", Resources.Dil.basariliguncelleme);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            else
            {
                vm.Alert = new VMAlert("danger", Resources.Dil.formukontrolet);
            }
            return(View(vm));
        }