public ActionResult Edit(Newstable newstable, HttpPostedFileBase file) { if (ModelState.IsValid && file != null && file.ContentLength > 0) { churchdbEntities1 db = new churchdbEntities1(); string ImageName = System.IO.Path.GetFileName(file.FileName); string physicalPath = Server.MapPath("~/nimage/" + ImageName); // save image in folder file.SaveAs(physicalPath); newstable.Nhead = Request.Form["Nhead"]; newstable.Ndate = Request.Form["Ndate"]; newstable.Ntext = Request.Form["Ntext"]; newstable.NUrl = "~/nimage/" + ImageName; db.Entry(newstable).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(newstable); }