public void UpdateProduct(ProductsWM webModel)
 {
     try
     {
         _productsOperations.UpdateProduct(ProductsMapping.MapToEntity(webModel));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.ToString());
     }
 }
 public void DeteleProducts(List <ProductsWM> webModelList)
 {
     try
     {
         _productsOperations.DeleteProducts(ProductsMapping.MapToEntity(webModelList));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.ToString());
     }
 }
        public void AddProduct(NewProductWM webModel)
        {
            #region AddProductValidations
            List <AddProductValidationBase> validationList = new List <AddProductValidationBase>();
            validationList.Add(new CheckProductImagePath());
            validationList.Add(new CheckProductCategory());
            validationList.Add(new CheckProductName());
            validationList.Add(new CheckProductUnitPrice());

            validationList[0].SetNextValidation(validationList[1]);
            validationList[1].SetNextValidation(validationList[2]);
            validationList[2].SetNextValidation(validationList[3]);

            validationList[0].Execute(webModel);
            bool webModelValid = validationList[validationList.Count - 1].IsValid;
            #endregion

            if (webModelValid)
            {
                try
                {
                    Bitmap image = new Bitmap(webModel.ImagePath);

                    ProductImages productImage = new ProductImages
                    {
                        ProductPicture = ImageToByteConverter.ConvertImagePath(image)
                    };

                    _productImagesOperations.AddProductImage(productImage);

                    _productsOperations.AddProduct(ProductsMapping.MapToEntity(webModel.Product));
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.ToString());
                }
            }
        }