public async Task <OperationResult> Handle(RemoveApontamentoCommand request, CancellationToken cancellationToken = default) { Apontamento obj = await _unitOfWork.ApontamentoRepository.GetAsync(request.Id); if (obj == null) { return(OperationResult.NotFound); } await _unitOfWork.ApontamentoRepository.RemoveAsync(request.Id); bool success = await _unitOfWork.SaveChangesAsync(); OperationResult result = success ? OperationResult.Success : OperationResult.Failed; return(result); }
public async UnaryResult <OperationResult> RemoveAsync(RemoveApontamentoCommand command) { return(await _mediator.Send(command)); }