public async Task ExecuteAsync(UpdateProductCommand command)
        {
            var productCategoryDomain = new ProductDomain(_domainService.WriteService);

            productCategoryDomain.Update(new ProductDto
            {
                Id   = command.Id,
                Name = command.Name
            });

            await _domainService.ApplyChangesAsync(productCategoryDomain);
        }
Exemple #2
0
        public Task ExecuteAsync(UpdateProductCommand command)
        {
            var productCategoryDomain = new ProductDomain(_writeService);

            productCategoryDomain.Update(new ProductDto
            {
                Id   = command.Id,
                Name = command.Name
            });

            _domainService.ApplyChanges(productCategoryDomain);
            return(Task.CompletedTask);
        }
Exemple #3
0
        public void Update()
        {
            using (var ctx = new ProductMNEntities())
            {
                var domain = new ProductDomain(ctx);

                var product = new Product();

                product.ProductName     = Product_Name.Text;
                product.SupplierID      = int.Parse(Suppliers_ID.SelectedValue);
                product.CategoryID      = int.Parse(Categories_ID.SelectedValue);
                product.UnitPrice       = decimal.Parse(Unit_Price.Text);
                product.UnitsInStock    = short.Parse(Units_In_Stock.Text);
                product.UnitsOnOrder    = short.Parse(Units_On_Order.Text);
                product.ReorderLevel    = short.Parse(Recorder_Level.Text);
                product.QuantityPerUnit = Quantity_Per_Unit.Text;
                product.Discontinued    = bool.Parse(Discountinued.SelectedValue);

                domain.Update(_productId, product);
                ctx.SaveChanges();
            }
        }