public ActionResult giris(Kullanicilar kullanicilar) { string strKul = kullanicilar.KullaniciAdi; string strSifre = kullanicilar.Sifre; if (strKul != "" && strSifre != "") { AheSergiDB myDB = new AheSergiDB(); var kullanici = myDB.Kullanicilar.Where(x => x.KullaniciAdi == strKul && x.Sifre == strSifre).FirstOrDefault(); if (kullanici != null) { Session["ID"] = kullanici.ID.ToString(); Session["kullaniciAdi"] = strKul; Response.Redirect("/Admin/Index"); } else { ViewBag.Hata = "Kullanıcı adı veya şifre hatalı"; } } ModelState.Clear(); return(View()); }
public ActionResult juriDuzenle(string id) { int tmpID = 0; if (!int.TryParse(id, out tmpID)) { Response.Redirect("/Admin/juriler"); } AheSergiDB myDB = new AheSergiDB(); dynamic mymodel = new ExpandoObject(); mymodel.Kategoriler = myDB.Kategoriler.ToList(); mymodel.Juri = myDB.Juri.Where(x => x.ID == tmpID).FirstOrDefault(); var yearList = new List <SelectListItem>(); yearList.Add(new SelectListItem() { Value = "", Text = "Seç" }); for (var i = DateTime.Now.Year; i >= 2007; i--) { yearList.Add(new SelectListItem() { Value = i.ToString(), Text = i.ToString() }); } mymodel.Tarih = yearList; return(View(mymodel)); }
public ActionResult kategoriler() { AheSergiDB myDB = new AheSergiDB(); var kategorilist = myDB.Kategoriler.Where(x => x.durum == 0).OrderBy(y => y.Kategori).ToList(); return(View(kategorilist)); }
public ActionResult juriler() { AheSergiDB myDB = new AheSergiDB(); var jurilist = myDB.Juri.Where(x => x.durum == 0).OrderByDescending(y => y.Tarih).ThenBy(y => y.AdSoyad).ToList(); return(View(jurilist)); }
public ActionResult Sergiler() { AheSergiDB myDB = new AheSergiDB(); var result = (from s in myDB.Sergi join k in myDB.Kategoriler on s.KategoriID equals k.ID select new { s.ID, s.Tarih, s.Adi, s.Baslik, s.GorselA, s.GorselB, s.Aktif, s.Genre, s.Technique, s.Material, s.Dimensions, s.Gallery, k.Kategori, s.durum }).Where(x => x.durum == 0).AsEnumerable().Select(x => x.ToExpando()); return(View(result)); }
public ActionResult sergiEkle() { AheSergiDB myDB = new AheSergiDB(); dynamic mymodel = new ExpandoObject(); mymodel.kategoriler = myDB.Kategoriler.Where(x => x.durum == 0).ToList(); var yearList = new List <SelectListItem>(); yearList.Add(new SelectListItem() { Value = "", Text = "Seç" }); for (var i = DateTime.Now.Year; i >= 2007; i--) { yearList.Add(new SelectListItem() { Value = i.ToString(), Text = i.ToString() }); } mymodel.Tarih = yearList; return(View(mymodel)); }
public ActionResult kategoriGuncelle(Kategoriler model) { AheSergiDB myDB = new AheSergiDB(); var dbKategori = myDB.Kategoriler.Where(x => x.ID == model.ID).FirstOrDefault(); dbKategori.Kategori = model.Kategori; myDB.SaveChanges(); TempData["Alert"] = new Alert { message = "Kategori Güncellendi", color = "green" }; return(RedirectToAction("kategoriler", "Admin")); }
public ActionResult kategoriKaydet(Kategoriler model) { //Kategoriler kategori = new Kategoriler { Kategori = frm["Kategori"].ToString(), durum = 0 }; AheSergiDB myDB = new AheSergiDB(); myDB.Kategoriler.Add(model); myDB.SaveChanges(); TempData["Alert"] = new Alert { message = "Yeni Kategori Eklendi", color = "green" }; return(RedirectToAction("kategoriler", "Admin")); }
public ActionResult kategoriDuzenle(string id) { int tmpID = 0; if (!int.TryParse(id, out tmpID)) { Response.Redirect("/Admin/kategoriler"); } AheSergiDB myDB = new AheSergiDB(); Kategoriler kategori = myDB.Kategoriler.Where(x => x.ID == tmpID && x.durum == 0).FirstOrDefault(); return(View(kategori)); }
public ActionResult juriGuncelle(Juri juri, HttpPostedFileBase file) { string strNewName = ""; if (file != null) { int fileSizeInBytes = file.ContentLength; string fileName = file.FileName.ToLower(); string fileExtension = ""; if (!string.IsNullOrEmpty(fileName)) { fileExtension = Path.GetExtension(fileName); } strNewName = setURL(fileName.Replace(fileExtension, "")) + "-" + Guid.NewGuid().ToString() + fileExtension; string savedFileName = Path.Combine(@Server.MapPath("~/uploads/Juri/"), strNewName); file.SaveAs(savedFileName); } if (strNewName != "") { juri.Gorsel = strNewName; } AheSergiDB myDB = new AheSergiDB(); var dbJuri = myDB.Juri.Where(x => x.ID == juri.ID).FirstOrDefault(); dbJuri.Tarih = juri.Tarih; dbJuri.AdSoyad = juri.AdSoyad; dbJuri.Gorsel = juri.Gorsel; dbJuri.Unvan = juri.Unvan; dbJuri.Bilgi = juri.Bilgi; myDB.SaveChanges(); TempData["Alert"] = new Alert { message = "Juri Güncellendi", color = "green" }; return(RedirectToAction("juriler", "Admin")); }
public ActionResult juriSil(string id) { int tmpID = 0; if (!int.TryParse(id, out tmpID)) { Response.Redirect("/Admin/juriler"); } AheSergiDB myDB = new AheSergiDB(); var juri = myDB.Juri.Where(x => x.ID == tmpID).FirstOrDefault(); juri.durum = 1; myDB.SaveChanges(); TempData["Alert"] = new Alert { message = "Juri Silindi", color = "green" }; return(RedirectToAction("juriler", "Admin")); }
public ActionResult sifreGuncelle(FormCollection frm) { if (frm["Sifre"].ToString() == frm["YeniSifre"].ToString()) { int nID = int.Parse(Session["ID"].ToString()); string eskiSifre = frm["EskiSifre"].ToString(); AheSergiDB myDB = new AheSergiDB(); Kullanicilar kullanici = myDB.Kullanicilar.Where(x => x.ID == nID && x.Sifre == eskiSifre).FirstOrDefault(); if (kullanici != null) { kullanici.Sifre = frm["YeniSifre"].ToString(); myDB.SaveChanges(); TempData["Alert"] = new Alert { message = "Kullanıcı bilgileri güncellendi", color = "green" }; } else { TempData["Alert"] = new Alert { message = "Eski şifreniz yanlış", color = "red" }; ModelState.Clear(); return(RedirectToAction("sifreGuncelle", "Admin")); } } else { TempData["Alert"] = new Alert { message = "Yeni Şifre Uyuşmuyor, aynı olmalı", color = "red" }; ModelState.Clear(); return(RedirectToAction("sifreGuncelle", "Admin")); } return(RedirectToAction("Index", "Admin")); }
public ActionResult juriKaydet(Juri juri, HttpPostedFileBase file) { string strNewName = ""; if (file != null) { int fileSizeInBytes = file.ContentLength; string fileName = file.FileName.ToLower(); string fileExtension = ""; if (!string.IsNullOrEmpty(fileName)) { fileExtension = Path.GetExtension(fileName); } strNewName = setURL(fileName.Replace(fileExtension, "")) + "-" + Guid.NewGuid().ToString() + fileExtension; string savedFileName = Path.Combine(@Server.MapPath("~/uploads/Juri/"), strNewName); file.SaveAs(savedFileName); } if (strNewName != "") { juri.Gorsel = strNewName; } AheSergiDB myDB = new AheSergiDB(); myDB.Juri.Add(juri); myDB.SaveChanges(); TempData["Alert"] = new Alert { message = "Yeni Jüri Eklendi", color = "green" }; return(RedirectToAction("juriler", "Admin")); }
public ActionResult Index(string id) { string tarih = "2020"; if (id == "") { int tmpID; if (int.TryParse(id, out tmpID)) { tarih = id; } } AheSergiDB myDB = new AheSergiDB(); var jurilist = myDB.Juri.Where(x => x.durum == 0 && x.Tarih == tarih).OrderBy(y => y.AdSoyad).ToList(); var sergilist1 = (from s in myDB.Sergi join k in myDB.Kategoriler on s.KategoriID equals k.ID select new { s.ID, s.Tarih, s.KategoriID, s.Adi, s.Baslik, s.GorselA, s.GorselB, s.Aktif, s.Genre, s.Technique, s.Material, s.Dimensions, s.Gallery, k.Kategori, s.durum }).Where(x => x.Tarih == tarih && x.durum == 0 && x.Aktif == true).OrderBy(x => x.KategoriID).AsEnumerable().Select(x => x.ToExpando()); ViewBag.sergiler = sergilist1; ViewBag.juriler = jurilist; int n1 = myDB.Sergi.Where(x => x.KategoriID == 1 && x.Tarih == tarih && x.durum == 0 && x.Aktif == true).Count(); int n2 = myDB.Sergi.Where(x => x.KategoriID == 2 && x.Tarih == tarih && x.durum == 0 && x.Aktif == true).Count(); int n3 = myDB.Sergi.Where(x => x.KategoriID == 3 && x.Tarih == tarih && x.durum == 0 && x.Aktif == true).Count(); int n4 = myDB.Sergi.Where(x => x.KategoriID == 4 && x.Tarih == tarih && x.durum == 0 && x.Aktif == true).Count(); int n5 = myDB.Sergi.Where(x => x.KategoriID == 5 && x.Tarih == tarih && x.durum == 0 && x.Aktif == true).Count(); string strLayout = ""; if (n1 > 0) { strLayout = n1.ToString() + ","; } if (n2 > 0) { strLayout += n2.ToString() + ","; } if (n3 > 0) { strLayout += n3.ToString() + ","; } if (n4 > 0) { strLayout += n4.ToString() + ","; } if (n5 > 0) { strLayout += n5.ToString() + ","; } ViewBag.layout = strLayout.Remove(strLayout.Length - 1, 1); ViewBag.tarih = tarih; return(View()); }
public ActionResult sergiKaydet(Sergi sergi, HttpPostedFileBase GorselA, HttpPostedFileBase GorselB) { string strNewNameA = ""; if (GorselA != null) { int fileSizeInBytes = GorselA.ContentLength; string fileName = GorselA.FileName.ToLower(); string fileExtension = ""; if (!string.IsNullOrEmpty(fileName)) { fileExtension = Path.GetExtension(fileName); } strNewNameA = setURL(fileName.Replace(fileExtension, "")) + "-" + Guid.NewGuid().ToString() + fileExtension; string savedFileName = Path.Combine(@Server.MapPath("~/uploads/sergi/"), strNewNameA); GorselA.SaveAs(savedFileName); } string strNewNameB = ""; if (GorselB != null) { int fileSizeInBytes = GorselB.ContentLength; string fileName = GorselB.FileName.ToLower(); string fileExtension = ""; if (!string.IsNullOrEmpty(fileName)) { fileExtension = Path.GetExtension(fileName); } strNewNameB = setURL(fileName.Replace(fileExtension, "")) + "-" + Guid.NewGuid().ToString() + fileExtension; string savedFileName = Path.Combine(@Server.MapPath("~/uploads/sergi/"), strNewNameB); GorselB.SaveAs(savedFileName); } if (strNewNameA != "") { sergi.GorselA = strNewNameA; } if (strNewNameB != "") { sergi.GorselB = strNewNameB; } AheSergiDB myDB = new AheSergiDB(); var dbSergi = new Sergi(); dbSergi.Tarih = sergi.Tarih; dbSergi.KategoriID = sergi.KategoriID; dbSergi.Adi = sergi.Adi; dbSergi.Baslik = sergi.Baslik; dbSergi.GorselA = sergi.GorselA; dbSergi.GorselB = sergi.GorselB; if (sergi.Aktif.ToString().ToLower() == "true") { dbSergi.Aktif = true; } else { dbSergi.Aktif = false; } dbSergi.Genre = sergi.Genre; dbSergi.Technique = sergi.Technique; dbSergi.Material = sergi.Material; dbSergi.Dimensions = sergi.Dimensions; dbSergi.Gallery = sergi.Gallery; myDB.Sergi.Add(dbSergi); myDB.SaveChanges(); TempData["Alert"] = new Alert { message = "Yeni Sergi Eklendi", color = "green" }; return(RedirectToAction("sergiler", "Admin")); }