public ActionResult Edit(Haberler haber, HttpPostedFileBase upload)
        {
            if (ModelState.IsValid)
            {
                var model = haberService.Find(haber.Id);
                if (upload != null && upload.ContentLength > 0)
                {
                    string fileName  = Path.GetFileName(upload.FileName);
                    string extension = Path.GetExtension(fileName).ToLower();
                    if (extension == ".jpg" || extension == ".jpeg" || extension == ".png" || extension == ".gif")
                    {
                        string path = Path.Combine(ConfigurationManager.AppSettings["uploadPath"], fileName);
                        upload.SaveAs(path);
                        haber.HaberPhoto = fileName;
                        haberService.Update(haber);
                        return(RedirectToAction("index"));
                    }
                    else
                    {
                        ModelState.AddModelError("Photo", "Dosya uzantısı .jpg, .jpeg, .png ya da .gif olmalıdır.");
                    }
                }
                else
                {
                    // resim seçilip yüklenmese bile diğer bilgileri güncelle
                    haberService.Update(haber);
                    return(RedirectToAction("index"));
                }
            }

            return(View(haber));
        }
 public IActionResult HaberGuncelle(Haber model)
 {
     try
     {
         haberService.Update(model);
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", ex.Message);
     }
     return(Redirect("/Editor/Index?x=" + editorServis.Get(c => c.Id == model.EditorId).HesapId.ToString()));
 }