Пример #1
0
        public ActionResult Alogin(kullanicilar kullaniciFormu, string ReturnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View("index", kullaniciFormu));
            }

            using (site2020Entities db = new site2020Entities())
            {
                var kullaniciVarmi = db.kullanicilar.FirstOrDefault(
                    x => x.kad == kullaniciFormu.kad && x.sifre == kullaniciFormu.sifre);

                if (kullaniciVarmi != null)
                {
                    FormsAuthentication.SetAuthCookie(kullaniciVarmi.kad, kullaniciFormu.BeniHatirla);

                    if (!string.IsNullOrEmpty(ReturnUrl))
                    {
                        return(RedirectToAction(ReturnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("/index", "anasayfa"));
                    }
                }

                ViewBag.Hata = "Kullanıcı adı veya Şifre Hatalı!!! ";

                return(View("index"));
            }
        }
Пример #2
0
 // GET: Admin/Iletisim
 public ActionResult Index()
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.iletisim.First();
         return(View(model));
     }
 }
Пример #3
0
 public ActionResult AnasayfaGuncelle()
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.anasayfa.First();
         return(View(model));
     }
 }
Пример #4
0
        public override string[] GetRolesForUser(string username)
        {
            site2020Entities db = new site2020Entities();

            var user = db.kullanicilar.FirstOrDefault(x => x.kad == username);

            return(new string[] { user.role });
        }
Пример #5
0
 public ActionResult Hakkimizda()
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.hakkimizda.Find(1);
         return(View(model));
     }
 }
Пример #6
0
 // GET: Default
 public ActionResult Index()
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.anasayfa.ToList();
         return(View(model));
     }
 }
Пример #7
0
        public ActionResult Urunler()
        {
            using (site2020Entities db = new site2020Entities())
            {
                var model = db.urunler.Where(x => x.aktif == true).OrderBy(x => x.sira).ToList();

                return(View(model));
            }
        }
Пример #8
0
 public ActionResult UrunDetay(int id)
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.urunler.Where(x => x.aktif == true && x.id == id).FirstOrDefault();
         if (model == null)
         {
             return(HttpNotFound());
         }
         return(View(model));
     }
 }
Пример #9
0
 public ActionResult YeniSayfa(int id)
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.anasayfa.Where(x => x.id == id).FirstOrDefault();
         if (model == null)
         {
             return(HttpNotFound());
         }
         return(View(model));
     }
 }
Пример #10
0
 public ActionResult Guncelle(int id)
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.kullanicilar.Find(id);
         if (model == null)
         {
             return(HttpNotFound());
         }
         return(View("kullaniciForm", model));
     }
 }
Пример #11
0
 public ActionResult Sil(int id)
 {
     using (site2020Entities db = new site2020Entities())
     {
         var model = db.kullanicilar.Find(id);
         if (model == null)
         {
             return(HttpNotFound());
         }
         db.kullanicilar.Remove(model);
         db.SaveChanges();
         TempData["kullanici"] = "Kullanıcı silme işlemi başarılı.";
         return(RedirectToAction("index"));
     }
 }
Пример #12
0
        public ActionResult Sil(int id)
        {
            using (site2020Entities db = new site2020Entities())
            {
                var silinecekUrun = db.urunler.Find(id);
                if (silinecekUrun == null)
                {
                    return(HttpNotFound());
                }

                db.urunler.Remove(silinecekUrun);
                db.SaveChanges();
                TempData["urun"] = "Ürün Başarılı bir şekilde silindi.";
                return(RedirectToAction("index"));
            }
        }
Пример #13
0
 public ActionResult Kaydet(anasayfa GelenVeri)
 {
     using (site2020Entities db = new site2020Entities())
     {
         var GuncellenecekVeri = db.anasayfa.First();
         if (!ModelState.IsValid)
         {
             return(View("AnasayfaGuncelle", GelenVeri));
         }
         if (GelenVeri.fotoFile != null)
         {
             GelenVeri.foto = Seo.DosyaAdiDuzenle(GelenVeri.fotoFile.FileName);
             GelenVeri.fotoFile.SaveAs(Path.Combine(Server.MapPath("~/Content/img"), Path.GetFileName(GelenVeri.foto)));
         }
         db.Entry(GuncellenecekVeri).CurrentValues.SetValues(GelenVeri);
         db.SaveChanges();
         TempData["anasayfaGuncelle"] = "";
         return(RedirectToAction("index", "anasayfa"));
     }
 }
Пример #14
0
        public ActionResult Kaydet(urunler gelenUrun)
        {
            if (!ModelState.IsValid)
            {
                return(View("urunForm", gelenUrun));
            }

            using (site2020Entities db = new site2020Entities())
            {
                if (gelenUrun.id == 0)//yeni ürün
                {
                    if (gelenUrun.fotoFile == null)
                    {
                        ViewBag.HataFoto = "Lütfen Fotograf Yükleyiniz.";
                        return(View("urunForm", gelenUrun));
                    }
                    string fotoAdi = Seo.DosyaAdiDuzenle(gelenUrun.fotoFile.FileName);
                    gelenUrun.foto = fotoAdi;
                    db.urunler.Add(gelenUrun);
                    gelenUrun.fotoFile.SaveAs(Path.Combine(Server.MapPath("~/Content/img"), Path.GetFileName(gelenUrun.foto)));
                    TempData["urun"] = "Ürün Başarılı bir şekilde eklendi.";
                }
                else//guncelleme
                {
                    var guncellenecekVeri = db.urunler.Find(gelenUrun.id);
                    if (gelenUrun.fotoFile != null)
                    {
                        string fotoAdi = Seo.DosyaAdiDuzenle(gelenUrun.fotoFile.FileName);
                        gelenUrun.foto = fotoAdi;
                        gelenUrun.fotoFile.SaveAs(Path.Combine(Server.MapPath("~/Content/img"), Path.GetFileName(gelenUrun.foto)));
                    }

                    db.Entry(guncellenecekVeri).CurrentValues.SetValues(gelenUrun);
                    TempData["urun"] = "Ürün başarılı bir şekilde güncellendi.";
                }
                db.SaveChanges();

                return(RedirectToAction("index"));
            }
        }
Пример #15
0
        public ActionResult Kaydet(kullanicilar gelenKullanici)
        {
            if (!ModelState.IsValid)
            {
                return(View("kullaniciForm", gelenKullanici));
            }

            using (site2020Entities db = new site2020Entities())
            {
                if (gelenKullanici.id == 0)
                {
                    db.kullanicilar.Add(gelenKullanici);
                    TempData["kullanici"] = "Kullanıcı başarılı bir şekilde eklendi.";
                }
                else
                {
                    var guncellenecekVeri = db.kullanicilar.Find(gelenKullanici.id);
                    db.Entry(guncellenecekVeri).CurrentValues.SetValues(gelenKullanici);
                    TempData["kullanici"] = "Kullanıcı başarılı bir şekilde güncellendi.";
                }
                db.SaveChanges();
                return(RedirectToAction("index"));
            }
        }