public async Task Edit(Product product, string galleryFiles, string tags) { //-------------------Tags--------------------- await _productTagService.DeleteByProductId(product.ProductId); if (!string.IsNullOrEmpty(tags)) { List <ProductTag> productTags = new List <ProductTag>(); foreach (string tag in tags.Split('-')) { productTags.Add(new ProductTag { ProductId = product.ProductId, TagTitle = tag.ToLowerInvariant().Trim() }); } _productTagService.Add(productTags); } ; //------------Create Gallery Product -------------- if (!string.IsNullOrEmpty(galleryFiles)) { List <ProductGallery> productGalleries = new List <ProductGallery>(); foreach (var Gallery in galleryFiles.Split(',')) { if (string.IsNullOrEmpty(Gallery)) { break; } productGalleries.Add(new ProductGallery { ProductId = product.ProductId, ImageName = Gallery, }); } await _productGalleryService.Add(productGalleries); } product.ModifiedDate = DateTime.Now; Update(product); await SaveAsync(); }