public async Task ExecuteAsync(DeleteProductCommand command) { var productCategoryDomain = new ProductDomain(_domainService.WriteService); productCategoryDomain.Delete(command.Id); await _domainService.ApplyChangesAsync(productCategoryDomain); }
public Task ExecuteAsync(DeleteProductCommand command) { var productCategoryDomain = new ProductDomain(_writeService); productCategoryDomain.Delete(command.Id); _domainService.ApplyChanges(productCategoryDomain); return(Task.CompletedTask); }
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(); } } }