public ActionResult nasilCalisirIconEkle(int id) { howIsWorkIcon icon = new howIsWorkIcon(); icon.howIsworkPictureId = id; return(View(icon)); }
public ActionResult nasilCalisirIconGuncelle(howIsWorkIcon icon, HttpPostedFileBase file) { if (ModelState.IsValid) { howIsWorkIcon changeicon = _icon.getOne(icon.id); if (changeicon != null) { if (file != null) { if (System.IO.File.Exists(Server.MapPath(changeicon.iconPath))) { System.IO.File.Delete(Server.MapPath(changeicon.iconPath)); } int picWidth = settings.howIsWorkIcon.Width; int pichHeight = settings.howIsWorkIcon.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/howIsWorkIcon"))) { pictureDraw.Save(Server.MapPath("/images/howIsWorkIcon/" + newName)); } changeicon.iconPath = "/images/howIsWorkIcon/" + newName; changeicon.iconAlt = file.FileName; changeicon.iconText = icon.iconText; _icon.update(changeicon); return(RedirectToAction("nasilCalisirIcon", new { area = "AdminPanel", id = changeicon.howIsworkPictureId })); } else { Session["bannerEklenemedi"] = "Lütfen Güncellemek İstediğiniz İkonu Ekleyiniz"; } return(View("nasilCalisirIconGuncelle", icon)); } else { Session["bannerEklenemedi"] = "Değiştirilmek İstenilen İkon Bulunamadı !"; } return(View("nasilCalisirIconGuncelle", icon)); } else { return(View("nasilCalisirIconGuncelle", icon)); } }
public int nasilCalisirIconSil(int id) { howIsWorkIcon isExist = _icon.getOne(id); if (isExist != null) { if (System.IO.File.Exists(Server.MapPath(isExist.iconPath))) { System.IO.File.Delete(Server.MapPath(isExist.iconPath)); } _icon.delete(isExist); return(1); } else { return(0); } }
public bool update(howIsWorkIcon howIsWorkIcon) { return(_howIsWorkIconDal.Update(howIsWorkIcon)); }
public bool delete(howIsWorkIcon howIsWorkIcon) { return(_howIsWorkIconDal.Delete(_howIsWorkIconDal.getOne(x => x.id == howIsWorkIcon.id))); }
public bool add(howIsWorkIcon howIsWorkIcon) { return(_howIsWorkIconDal.Add(howIsWorkIcon)); }