//string artistName) public ActionResult Index() { PhotoList photos = new PhotoList(); List<string> fileList = new List<string>(); var dirList = System.IO.Directory.GetDirectories(Server.MapPath(Url.Content("~/Content/Artists/"))); Random rand = new Random(); //Selects a random sample of 10 pictures and returns them to the view to use in the slider. foreach (string directory in dirList) { var artist = GetArtistName(directory); var files = from f in System.IO.Directory.GetFiles(directory) where System.IO.Path.GetFileName(f).ToUpper().StartsWith("TAT") select f; fileList.AddRange(files); foreach (string fileName in files) { decimal sortKey = rand.Next(); photos.Add( new Models.Photo { FileName = artist + "/" + System.IO.Path.GetFileName(fileName), Title = GetTitle(fileName), SortKey = sortKey}); } } photos.Sort((p1, p2) => (p1.SortKey.CompareTo(p2.SortKey))); return View(new PhotoList(photos.GetRange(0, 10))); }