private static void processImage(string text) { if (_firstRowForProduct) { //text here should be a list of comma sepearated URLs, in order of display var urls = extractCsvList(text); var curUrlCount = 1; urls.ForEach(currentUrl => { if (!string.IsNullOrWhiteSpace(currentUrl)) { //note: no validation here, Radar already does all of that. var curMedia = _currentProduct.ProductMediaItems.FirstOrDefault(m => m.Media.Url == currentUrl); if (curMedia == null) { //add it var m = new Media { Url = currentUrl }; var pm = new ProductMediaItem { Media = m, MediaRank = curUrlCount++ }; _currentProduct.ProductMediaItems.Add(pm); } else { curMedia.MediaRank = curUrlCount++; } } }); } }
private static void processImage(string text) { if (_firstRowForProduct) { //text here should be a list of comma sepearated URLs, in order of display var urls = extractCsvList(text); var curUrlCount = 1; urls.ForEach(currentUrl => { if (!string.IsNullOrWhiteSpace(currentUrl)) { //note: no validation here, Radar already does all of that. var curMedia = _currentProduct.ProductMediaItems.FirstOrDefault(m => m.Media.Url == currentUrl); if (curMedia == null) { //add it var m = new Media {Url = currentUrl}; var pm = new ProductMediaItem {Media = m, MediaRank = curUrlCount++}; _currentProduct.ProductMediaItems.Add(pm); } else { curMedia.MediaRank = curUrlCount++; } } }); } }