示例#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
                });
            }
        }