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

            productCategoryDomain.Delete(command.Id);

            await _domainService.ApplyChangesAsync(productCategoryDomain);
        }
Ejemplo n.º 2
0
        public Task ExecuteAsync(DeleteProductCommand command)
        {
            var productCategoryDomain = new ProductDomain(_writeService);

            productCategoryDomain.Delete(command.Id);

            _domainService.ApplyChanges(productCategoryDomain);
            return(Task.CompletedTask);
        }
Ejemplo n.º 3
0
        public void Delete(int id)
        {
            using (var ctx = new ProductMNEntities())
            {
                var domain  = new ProductDomain(ctx);
                var product = domain.FindById(id);

                if (product != null)
                {
                    domain.Delete(product);
                    ctx.SaveChanges();
                }
            }
        }