Exemplo n.º 1
0
            public async Task <IResult> Handle(DeleteProductCommand request, CancellationToken cancellationToken)
            {
                var productToDelete = _productDal.Get(p => p.ProductID == request.ProductID);

                await _productDal.DeleteAsync(productToDelete);

                return(new SuccessResult(Messages.ProductDeleted));
            }
            public async Task <Unit> Handle(DeleteProductCommand request, CancellationToken cancellationToken)
            {
                var productToDelete = _productDal.Get(p => p.ProductId == request.ProductId);

                await _productDal.DeleteAsync(productToDelete);

                return(Unit.Value);
            }
Exemplo n.º 3
0
        public async Task <IResult> DeleteAsync(Product product)
        {
            try
            {
                await _productDal.DeleteAsync(product);

                return(new SuccessResult("Product added successfully"));
            }
            catch (Exception ex)
            {
                return(new ErrorResult(ex.Message, "Business.ProductManager.DeleteAsync"));
            }
        }
Exemplo n.º 4
0
 public IResult DeleteAsync(Product product)
 {
     _productDal.DeleteAsync(product);
     return(new SuccessResult(ProductMessages.Deleted));
 }
 public async Task DeleteAsync(Product entity, bool realDelete = false)
 {
     var cancelToken = new CancellationTokenSource();
     await _productDal.DeleteAsync(entity, cancelToken.Token, realDelete);
 }
Exemplo n.º 6
0
        public async Task <IResult> Delete(Product product)
        {
            await _productDal.DeleteAsync(product);

            return(new SuccessResult(Messages.ProductDeleted));
        }