public List<WowSliderClass> GetImages(string imagesPath, string ttPath) { string MappedPath = Server.MapPath("~/" + imagesPath); DirectoryInfo imagesDirectory = new DirectoryInfo(MappedPath); FileInfo[] imagesInfo = imagesDirectory.GetFiles(); IEnumerable<string> imgFiles = imagesInfo.Select(f => f.Name); ViewBag.imagePath = "../../" + imagesPath + "/"; ViewBag.ttPath = "../../" + ttPath + "/"; List<WowSliderClass> fc = new List<WowSliderClass>(); foreach (string str in imgFiles) { WowSliderClass f = new WowSliderClass(); f.imageName = str; f.ttName = str.ToLower(); fc.Add(f); } ViewBag.tts = imgFiles.ToString().ToLower(); return fc; }
// // GET: /Gallery/ public ActionResult Index() { string imagesPath = "Wowslider/Events/HolmdelWalkathon/data1/images"; string ttPath = "Wowslider/Events/HolmdelWalkathon/data1/tooltips"; string MappedPath = Server.MapPath("~/" + imagesPath); DirectoryInfo imagesDirectory = new DirectoryInfo(MappedPath); FileInfo[] imagesInfo = imagesDirectory.GetFiles(); IEnumerable<string> imgFiles = imagesInfo.Select(f => f.Name); ViewBag.imagePath = "../../" + imagesPath + "/"; ViewBag.ttPath = "../../" + ttPath + "/"; List<WowSliderClass> fc = new List<WowSliderClass>(); foreach (string str in imgFiles) { WowSliderClass f = new WowSliderClass(); f.imageName = str; f.ttName = str.ToLower(); fc.Add(f); } ViewBag.tts = imgFiles.ToString().ToLower(); return View(fc); //return View(fc); }