Exemple #1
0
        public Task <bool> Handle(CadastraAlunoCommand request, CancellationToken cancellationToken)
        {
            if (request.IsValid())
            {
                var aluno = _mapper.Map <Aluno>(request);

                _alunoRepository.Adicionar(aluno);

                return(Task.FromResult(_alunoRepository.Commit()));
            }

            _mediator.Publish(new ErrorNotification {
                Validations = request.Validation.Errors
            });

            return(Task.FromResult(false));
        }