public virtual void InsertProduct(NaseejProduct product) { if (product == null) { throw new ArgumentNullException(nameof(product)); } //insert _productRepository.Insert(product); }
public virtual void UpdateProduct(NaseejProduct product) { if (product == null) { throw new ArgumentNullException(nameof(product)); } //update _productRepository.Update(product); }
public virtual void DeleteProduct(NaseejProduct product) { if (product == null) { throw new ArgumentNullException(nameof(product)); } product.Deleted = true; //delete product UpdateProduct(product); }
public ProductModel PrepareProductModel(ProductModel model, NaseejProduct product) { if (product != null) { //fill in model values from the entity model = model ?? product.ToModel <ProductModel>(); // Auomapper and dto var Product = _productService.GetProductById(product.Id); } if (product == null) { if (model.ItemCount > model.Quantity) { throw new Exception(); } } return(model); }