コード例 #1
0
ファイル: Program.cs プロジェクト: snabbas/importpoc2
 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++;
                 }
             }
         });
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: snabbas/importpoc2
 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++;
                 }
             }
         });
     }
 }