public ActionResult Index()
 {
     var imagesModel = new ImageGallery();
     var imageFiles = Directory.GetFiles(Server.MapPath("~/Upload_Files/"));
     foreach (var item in imageFiles)
     {
         var paths = Path.GetFileName(item);
         //   imagesModel.ImageList.Add(Path.GetFileName(paths));
     }
     return View(imagesModel);
 }
 public ActionResult UploadImageMethod()
 {
     if (Request.Files.Count != 0)
     {
         var keys = Request.Files.AllKeys;
         for (var i = 0; i < Request.Files.Count; i++)
         {
             var file = Request.Files[i];
             var fileSize = file.ContentLength;
             var fileName = keys[i];
             var target = "~/Upload_Files/" + fileName;
             var path = Server.MapPath(target);
             file.SaveAs(path);
             var imageGallery = new ImageGallery();
             imageGallery.ID = Guid.NewGuid();
             imageGallery.Name = fileName;
             imageGallery.ImagePath = "~/Upload_Files/" + fileName;
             db.ImageGallery.Add(imageGallery);
             db.SaveChanges();
         }
         return Content("Success");
     }
     return Content("failed");
 }