public bool InsertProductImageReference(IProductImage productImage) { if (!IsExists(productImage)) { productImage.ProductImageId = GetIdForNextProductImage(); if (productImage.ProductImageId == 0) { productImage.ProductImageId++; } return(_context.Execute(@" INSERT ProductsImages (ProductImageId, ProductId, ImageId) VALUES (@productimageid, @productid, @imageid) ", new { productimageid = productImage.ProductImageId, productid = productImage.ProductId, imageid = productImage.ImageId }) != 0); } else { return(false); } }
// method to remove product image public static bool Remove(string apiUrl, string sessionId, object[] args) { IProductImage proxy = (IProductImage)XmlRpcProxyGen.Create(typeof(IProductImage)); proxy.Url = apiUrl; return(proxy.Remove(sessionId, _catalog_product_attribute_media_remove, args)); }
/// <summary> /// Initializes a new instance of the <see cref="ProductController" /> class. /// </summary> /// <param name="_iProduct">The i product.</param> /// <param name="_iCategory">The i category.</param> /// <param name="_iProductUnit">The i product unit.</param> /// <param name="_iProductCategory">The i product category.</param> /// <param name="_iProductColor">Color of the i product.</param> /// <param name="_iProductImage">The i product image.</param> /// <param name="_iProductSize">Size of the i product.</param> public ProductController(IProduct _iProduct, ICategory _iCategory, IProductUnit _iProductUnit, IProductCategory _iProductCategory, IProductColor _iProductColor, IProductImage _iProductImage, IProductSize _iProductSize) { iProduct = _iProduct; iCategory = _iCategory; iProductUnit = _iProductUnit; iProductCategory = _iProductCategory; iProductColor = _iProductColor; iProductImage = _iProductImage; iProductSize = _iProductSize; }
public bool DeleteProductImageReference(IProductImage productImage) => _context.Execute(@" DELETE FROM ProductsImages WHERE ProductId = @productid AND ImageId = @imageid ", new { productid = productImage.ProductId, imageid = productImage.ImageId }) != 0;
public bool IsExists(IProductImage productImage) => _context.ExecuteScalar <int>(@" SELECT COUNT(ProductImageId) FROM ProductsImages WHERE ProductId = @productid AND ImageId = @imageid ", new { productid = productImage.ProductId, imageid = productImage.ImageId }) != 0;
public int GetProductImageId(IProductImage productImage) => _context.ExecuteScalar <int>(@" SELECT ProductImageId FROM ProductsImages WHERE ProductId = @productid AND ImageId = @imageid ", new { productid = productImage.ProductId, imageid = productImage.ImageId });
public ProductImageViewModel(IProductImage image) { this.Id = image.Id; this.Url = image.SecureUrl; this.Thumbnail = image.SecureThumbnail; }
public ProductImageService(IProductImage productImageRespository, IMapper mapper) : base(productImageRespository) { _productImageRespository = productImageRespository; _mapper = mapper; }