public ActionResult Edit([Bind(Include = "ExhibitionId,UserId,Title,ImagePath,Location,Address,Statement,StartDate,EndDate")] Exhibition exhibition)
        {
            if (ModelState.IsValid)
            {
                string oldpicpath = Request.Form["OldImagePath"];
                TryUpdateModel(exhibition);
                exhibition.Modified = DateTime.Now;

                db.Entry(exhibition).State = EntityState.Modified;
                if (Request.Files["ImagePath"].ContentLength != 0)
                {
                    string imagePath = Server.MapPath(Global.ExhibitionImages + string.Format("Exhibition_{0}_{1}.jpg", exhibition.ExhibitionId, DateTime.Now.ToString("ddMMyyss")));
                    exhibition.ImagePath = ImageHelper.UploadImage(Request.Files["ImagePath"], Global.ExhibitionImages, imagePath, false);
                }
                else
                {
                    exhibition.ImagePath = oldpicpath;
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(exhibition));
        }
        public ActionResult Edit([Bind(Include = "EventId,Title,Location,Address,Statement,StartDate,EndDate,Created,Modified,ImagePath,DisplayInHomePage,IsExternal,ExternalLink")] Event @event)
        {
            if (ModelState.IsValid)
            {
                string oldpicpath = Request.Form["OldImagePath"];
                TryUpdateModel(@event);
                @event.Modified = DateTime.Now;

                db.Entry(@event).State = EntityState.Modified;
                if (Request.Files["ImagePath"].ContentLength != 0)
                {
                    string imagePath = Server.MapPath(Global.EventImages + string.Format("Event_{0}_{1}.jpg", @event.EventId, DateTime.Now.ToString("ddMMyyss")));
                    @event.ImagePath = ImageHelper.UploadImage(Request.Files["ImagePath"], Global.EventImages, imagePath, false);
                }
                else
                {
                    @event.ImagePath = oldpicpath;
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(@event));
        }
 public ActionResult Edit([Bind(Include = "ConfigurationId,Key,Value")] Configuration configuration)
 {
     if (ModelState.IsValid)
     {
         db.Entry(configuration).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(configuration));
 }