コード例 #1
0
    public async Task <OperationResult> Handle(RemoveProjetoCommand request, CancellationToken cancellationToken)
    {
        Projeto obj = await _unitOfWork.ProjetoRepository.GetAsync(request.Id);

        if (obj == null)
        {
            return(OperationResult.NotFound);
        }

        await _unitOfWork.ProjetoRepository.RemoveAsync(request.Id);

        bool success = await _unitOfWork.SaveChangesAsync();

        OperationResult result = success ? OperationResult.Success : OperationResult.Failed;

        return(result);
    }
コード例 #2
0
 public async UnaryResult <OperationResult> RemoveAsync(RemoveProjetoCommand command)
 {
     return(await _mediator.Send(command));
 }