public async Task <Unit> Handle(TarefaDeleteCommand request, CancellationToken cancellationToken)
        {
            var tarefaEntity = tarefaDomainService.Get(request.TarefaId, request.UsuarioId);

            //excluindo no dominio (sqlserver)
            tarefaDomainService.Delete(tarefaEntity);

            //excluindo no mongodb
            await mediator.Publish(new TarefaNotification
            {
                Tarefa = tarefaEntity,
                Action = ActionNotification.Delete
            });

            return(Unit.Value);
        }
        public async Task <IActionResult> Delete(Guid tarefaId, Guid usuarioId)
        {
            try
            {
                var command = new TarefaDeleteCommand {
                    TarefaId = tarefaId, UsuarioId = usuarioId
                };

                await tarefaApplicationService.Delete(command);

                return(StatusCode(200, new
                {
                    message = "Tarefa excluída com sucesso."
                }));
            }
            catch (Exception e)
            {
                return(StatusCode(500, new
                {
                    e.Message
                }));
            }
        }
 public async Task Delete(TarefaDeleteCommand command)
 {
     await mediator.Send(command);
 }