public static IList <Album> GetAll() { var pathGellaryPhoto = ConfigurationManager.AppSettings["pathGalleryPhoto"]; var pathDefaultPhoto = ConfigurationManager.AppSettings["pathDefaultPhoto"]; IGalleryRepository galleryRepo = new GalleryRepository(); var albums = galleryRepo.GetAll().ToList(); foreach (var album in albums) { if (album.HeadImage != "" && album.HeadImage != null) { album.HeadImage = pathGellaryPhoto + album.HeadImage; } else { album.HeadImage = pathDefaultPhoto; } foreach (var photo in album.Photos) { photo.Path = pathGellaryPhoto + photo.Path; } } return(albums); }