public static UploadedImage FromSession(string routeName, string file) { UploadedImages list = UploadedImages.FromSession(routeName); foreach (UploadedImage img in list) { if (img.file == file) { return(img); } } return(null); }
public static UploadedImages FromSession(string routeName) { string key = GetKey(routeName); UploadedImages list = HttpContext.Current.Session[key] as UploadedImages; if (list == null) { list = new UploadedImages(); HttpContext.Current.Session[key] = list; //carico i file già presenti su file system ImageCache cache = Helper.GetImageCache(PathFunctions.GetImagePathFromRouteName(routeName)); for (int i = 0; i < cache.files.Length; i++) { UploadedImage img = new UploadedImage( cache.files[i], cache.captions[i] ); list.Add(img); } } return(list); }