public ActionResult nasilCalisirResimEkle() { howIsWorkPicture work = new howIsWorkPicture(); work.howIsWorkId = settings.how; return(View(work)); }
public ActionResult nasilCalisirResimGuncelle(howIsWorkPicture pic, HttpPostedFileBase file) { if (ModelState.IsValid) { howIsWorkPicture changePicture = _picture.getOne(pic.id); if (changePicture != null) { if (file != null) { if (System.IO.File.Exists(Server.MapPath(changePicture.picturePath))) { System.IO.File.Delete(Server.MapPath(changePicture.picturePath)); } int picWidth = settings.howIsWorkPicture.Width; int pichHeight = settings.howIsWorkPicture.Height; string newName = ""; if (file.FileName.Length > 10) { newName = Path.GetFileNameWithoutExtension(file.FileName.Substring(0, 10)) + Guid.NewGuid() + Path.GetExtension(file.FileName); } else { newName = Path.GetFileNameWithoutExtension(file.FileName) + "-" + Guid.NewGuid() + Path.GetExtension(file.FileName); } Image orjResim = Image.FromStream(file.InputStream); Bitmap pictureDraw = new Bitmap(orjResim, picWidth, pichHeight); if (Directory.Exists(Server.MapPath("/images/howIsWorkPicture"))) { pictureDraw.Save(Server.MapPath("/images/howIsWorkPicture/" + newName)); } changePicture.picturePath = "/images/howIsWorkPicture/" + newName; changePicture.pictureAlt = file.FileName; changePicture.pictureText = pic.pictureText; changePicture.stepText = pic.stepText; _picture.update(changePicture); Session["bannerEklenemedi"] = "Resim Başarıyla Güncellendi"; return(RedirectToAction("nasilCalisirResim", new { area = "AdminPanel" })); } else { Session["bannerEklenemedi"] = "Lütfen Güncellemek İstediğiniz Resmi Ekleyiniz"; } return(View("nasilCalisirResimGuncelle", pic)); } else { Session["bannerEklenemedi"] = "Değiştirilmek İstenilen Resim Bulunamadı !"; } return(View("nasilCalisirResimGuncelle", pic)); } else { return(View("nasilCalisirResimGuncelle", pic)); } }
public ActionResult nasilCalisirResimSil(int id) { howIsWorkPicture isExist = _picture.getOne(id); if (isExist != null) { if (System.IO.File.Exists(Server.MapPath(isExist.picturePath))) { System.IO.File.Delete(Server.MapPath(isExist.picturePath)); } _picture.delete(isExist); return(Json(new { id = 1, message = "Resim Başarıyla Silindi!" })); } else { return(Json(new { id = 0, message = "Resim Silinemedi, Lütfen Tekrar Deneyiniz!" })); } }
public ActionResult nasilCalisirResimEkle(howIsWorkPicture picture, HttpPostedFileBase file) { if (ModelState.IsValid) { if (file != null) { int picWidth = settings.howIsWorkPicture.Width; int pichHeight = settings.howIsWorkPicture.Height; string newName = ""; if (file.FileName.Length > 10) { newName = Path.GetFileNameWithoutExtension(file.FileName.Substring(0, 10)) + Guid.NewGuid() + Path.GetExtension(file.FileName); } else { newName = Path.GetFileNameWithoutExtension(file.FileName) + "-" + Guid.NewGuid() + Path.GetExtension(file.FileName); } Image orjResim = Image.FromStream(file.InputStream); Bitmap pictureDraw = new Bitmap(orjResim, picWidth, pichHeight); if (Directory.Exists(Server.MapPath("/images/howIsWorkPicture"))) { pictureDraw.Save(Server.MapPath("/images/howIsWorkPicture/" + newName)); } picture.picturePath = "/images/howIsWorkPicture/" + newName; picture.pictureAlt = file.FileName; _picture.add(picture); Session["bannerEklenemedi"] = "Resim Başarıyla Eklendi"; return(RedirectToAction("nasilCalisirResim", new { area = "AdminPanel" })); } else { Session["bannerEklenemedi"] = "Lütfen Eklemek İstediğiniz Resmi Ekleyiniz"; } return(View("nasilCalisirResimEkle", picture)); } else { return(View("nasilCalisirResimEkle", picture)); } }
public bool update(howIsWorkPicture howIsWorkPicture) { return(_howIsWorkPictureDal.Update(howIsWorkPicture)); }
public bool delete(howIsWorkPicture howIsWorkPicture) { return(_howIsWorkPictureDal.Delete(_howIsWorkPictureDal.getOne(x => x.id == howIsWorkPicture.id))); }
public bool add(howIsWorkPicture howIsWorkPicture) { return(_howIsWorkPictureDal.Add(howIsWorkPicture)); }