예제 #1
0
        public async Task <NotaAlunoPorBimestreResposta> Handle(ObterNotasAlunoQuery request, CancellationToken cancellationToken)
        {
            var notaAlunoPorBimestreResposta = _notaAlunoRepositorio.ObterNotasAluno(request.AnoLetivo, request.Bimestre, request.CodigoUe, request.CodigoTurma, request.CodigoAluno);
            var notaAlunoCor = _notaAlunoCorRepositorio.ObterAsync();
            await Task.WhenAll(notaAlunoPorBimestreResposta, notaAlunoCor);

            var notasAlunoPorBimestreRespostaConsolidado = notaAlunoPorBimestreResposta.Result;

            if (notasAlunoPorBimestreRespostaConsolidado is null)
            {
                throw new NegocioException("Não foi possível obter as notas do aluno.");
            }

            DefinirCoresDasNotas(notasAlunoPorBimestreRespostaConsolidado, notaAlunoCor.Result);
            return(notasAlunoPorBimestreRespostaConsolidado);
        }