// // GET: /Album/ public ActionResult Detail(int id, int? page) { T_AlbumServices _service = new T_AlbumServices(); T_Album albumList = _service.GetByID(id); ViewBag.Title = albumList.Title; List<string> FileList = new List<string>(); T_Album album = _service.GetByID(id); var albumFolder = Constants.ALBUM_FOLDER_PATH + album.Slug; if (System.IO.Directory.Exists(Server.MapPath(albumFolder))) { foreach (var item in System.IO.Directory.GetFiles(Server.MapPath(albumFolder))) { FileList.Add(Path.Combine(albumFolder, System.IO.Path.GetFileName(item))); } } int currentPageIndex = page.HasValue ? page.Value - 1 : 0; IPagedList<string> MyList = FileList.ToPagedList(currentPageIndex, 20, FileList.Count); return View(MyList); }