Ejemplo n.º 1
0
 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++;
                 }
             }
         });
     }
 }
Ejemplo n.º 2
0
 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++;
                 }
             }
         });
     }
 }