public ActionResult Edit(Partner partner, HttpPostedFileBase Photo, string OldPhoto)
        {
            if (Photo != null)
            {
                string filePath = Server.MapPath("~/Uploads/" + OldPhoto);
                if (System.IO.File.Exists(filePath))
                {
                    System.IO.File.Delete(filePath);
                }

                string filename = DateTime.Now.ToString("yyyyMMddHHmmss") + Photo.FileName.Replace(" ", "_");
                string path     = System.IO.Path.Combine(Server.MapPath("~/Uploads"), filename);
                Photo.SaveAs(path);
                partner.Photo           = filename;
                db.Entry(partner).State = EntityState.Modified;
                db.SaveChanges();
            }
            else
            {
                db.Partners.Attach(partner);
                db.Entry(partner).State = EntityState.Modified;
                db.Entry(partner).Property(p => p.Photo).IsModified = false;
                db.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit(Contact contact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contact).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("index"));
     }
     return(View(contact));
 }