public ICommandResult handle(CreateProductCommand command) { //fast fail validations command.Validate(); if (command.Invalid) { return(new CommandResult("Command invalid", false, command.Notifications)); } var product = new Product(); product.Name = command.Name; product.Price = command.Price; product.Reviews = command.Reviews; product.Amount = command.Amount; product.AnimalType = command.AnimalType; _productRespository.Add(product); return(new CommandResult("Product created", true, product)); }
public void AddProduct(Product product) { _iRespository.Add(product); }