Beispiel #1
0
        public void Trigger(ProductCommand command)
        {
            var productName     = new ProductName(command.GetName);
            var productCategory = new ProductCategory(command.GetCategoryId);
            var productBrand    = new ProductBrand(command.GetBrand);
            var productPacking  = new ProductPacking(command.GetPackingId);

            Creator.Create(productName, productBrand, productCategory, productPacking, command.GetPrice, command.GetRefrigerated
                           , command.GetExpirationDate, command.GetWeight, command.GetDescription, command.GetTotalPrice);
        }
        public void Create(ProductName name, ProductBrand brand, ProductCategory category, ProductPacking packing, decimal price
                           , bool refrigerated, DateTime expirationDate, double weight, string description, decimal totalPrice)
        {
            var product = new Product()
            {
                Name           = name.GetValue(),
                Brand          = brand.GetValue(),
                CategoryId     = category.GetValue(),
                PackingTypeId  = packing.GetValue(),
                Price          = price,
                Refrigerated   = refrigerated,
                ExpirationDate = expirationDate,
                Weight         = weight,
                Description    = description,
                TotalPrice     = totalPrice
            };

            Repository.Save(product);
        }