Ejemplo n.º 1
0
        public void AddNewCategory(Category category)
        {
            if (category == null || string.IsNullOrWhiteSpace(category.Name))
            {
                throw new InvalidOperationException("Category name is missing");
            }

            _storeUnitOfWork.CategoryRepository.Add(category);
            _storeUnitOfWork.Save();
        }
Ejemplo n.º 2
0
        public void AddExistingStock(Stock stock)
        {
            var oldStock = _storeUnitOfWork.StockRepository.GetById(stock.Id);

            oldStock.TotalProductCount += stock.TotalProductCount;
            oldStock.TotalAmount        = stock.TotalAmount;
            oldStock.TotalProductSale   = stock.TotalProductSale;

            _storeUnitOfWork.Save();
        }
Ejemplo n.º 3
0
        //public void AddNewProduct(Product product)
        //{
        //    _storeUnitOfWork.ProductRepositroy.Add(new Product
        //    {
        //        Name = product.Name,
        //        Description = product.Description,
        //        ImageUrl = product.ImageUrl,
        //        Categories = product.Categories,
        //        Price = product.Price,
        //    });
        //    _storeUnitOfWork.Save();
        //}

        public void AddNewProduct(Product product, ProductImage productImage, ProductCategory productCategory)
        {
            _storeUnitOfWork.ProductRepositroy.Add(product);

            _storeUnitOfWork.ImageRepository.Add(productImage);

            _storeUnitOfWork.ProductCategoryRepository.Add(productCategory);

            _storeUnitOfWork.Save();
        }
Ejemplo n.º 4
0
        public void AddImage(ProductImage productImage)
        {
            if (productImage == null || string.IsNullOrWhiteSpace(productImage.Url))
            {
                throw new InvalidOperationException("Product-Image Name is missing");
            }

            _storeUnitOfWork.ImageRepository.Add(productImage);
            _storeUnitOfWork.Save();
        }
 public void DeleteProductFeature(int id)
 {
     _storeUnitOfWork.ProductFeatureRepository.Remove(id);
     _storeUnitOfWork.Save();
 }