public ActionResult AddGallery(Gallery gallery) { if (ModelState.IsValid) { socialService.InsertGallery(gallery); socialService.Save(); var folder = Server.MapPath("/") + gallery.PictureFolder; if (!System.IO.Directory.Exists(folder)) { System.IO.Directory.CreateDirectory(folder); } return(RedirectToAction("EditGallery", new { id = gallery.GalleryID })); } return(View(gallery)); }