public Product Create(CreateProductCommand command) { var product = new Product(command.Title, command.Description, command.Price, command.QuantityOnHand, command.CategoryId); product.Register(); _repository.Create(product); if (Commit()) return product; return null; }
public void AddProduct(Product product, int quantity, decimal price) { if (!this.AddProductScopeIsValid(product, price, quantity)) return; this.ProductId = product.Id; this.Product = product; this.Quantity = quantity; this.Price = price; // Reserva o estoque this.Product.UpdateQuantityOnHand(this.Product.QuantityOnHand - quantity); }
public void Update(Product product) { _context.Entry<Product>(product).State = System.Data.Entity.EntityState.Modified; }
public void Delete(Product product) { _context.Products.Remove(product); }
public void Create(Product product) { _context.Products.Add(product); }