コード例 #1
0
 public void AddImages(int productId, string[] images)
 {
     _productImageRepository.RemoveMultiple(_productImageRepository.FindAll(x => x.ProductId == productId).ToList());
     foreach (var image in images)
     {
         _productImageRepository.Add(new ProductImage()
         {
             Path      = image,
             ProductId = productId,
             Caption   = string.Empty
         });
     }
 }
コード例 #2
0
        public async Task AddImages(int productId, string[] images)
        {
            await _productImageRepository.RemoveMultiple((await _productImageRepository.FindAll(x => x.ProductId == productId)).AsNoTracking().AsParallel().AsOrdered().ToList());

            foreach (var image in images)
            {
                await _productImageRepository.Add(new ProductImage()
                {
                    Path      = image,
                    ProductId = productId,
                    Caption   = string.Empty
                });
            }
        }