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 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 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")); }