Beispiel #1
0
        public IActionResult Get(string id)
        {
            _typer.SetCurrentTyper(typeof(Turma));
            var turma = repositoryRead.GetSingle(id) as Turma;

            if (turma == null)
            {
                return(NotFound(id));
            }

            _typer.SetCurrentTyper(typeof(Aluno));
            var alunos = repositoryRead.Search <Aluno>(x => x.TurmaId == id);

            turma.SetAlunos(alunos);

            _typer.SetCurrentTyper(typer: typeof(Domain.Entities.Chamada));
            var chamadas = repositoryRead.Search <Domain.Entities.Chamada>(x => x.TurmaId == id);

            turma.SetChamadas(chamadas);

            _typer.SetCurrentTyper(typeof(Turma));
            var tipoModelTurma = _typer.GetRefTyper("ViewModel", TyperAction.GetSingle);
            var model          = mapper.Map(turma, typeof(Turma), tipoModelTurma);

            return(ResponseApi(model));
        }