Example #1
0
        public async Task <ActionResult> Perfil()
        {
            if (!AlunoLogado())
            {
                return(RedirectToAction(nameof(Login)));
            }
            var retorno1 = await _apiAlunos.BuscarPorMatricula(PegarAlunoLogado());

            var turma = await _apiTurma.BuscarAsync(retorno1.Serie, retorno1.Turma, retorno1.Turno);

            retorno1.Turma = turma.Nome;
            return(View(retorno1));
        }
        public async Task <ActionResult> Editar(Guid id)
        {
            //ViewBag.Turma = new SelectList(
            //        await _apiTurma.BuscarAsync(),
            //        "Id",
            //        "Nome");


            var model = await _api.BuscarAsync(id);

            var turma = await _apiTurma.BuscarAsync(model.Serie, model.Turma, model.Turno);

            ViewBag.Turma = turma.Nome;
            return(View(model));
        }
Example #3
0
        private async Task <List <JsTreeRoot> > BuscarTurma(string turma = null)
        {
            var modelCurso = await _apicursoA.BuscarAsync();

            var sorted = from x in modelCurso
                         orderby x.Nome ascending
                         select x;
            List <JsTreeRoot> nodes = new List <JsTreeRoot>();

            List <JsTreeModel> child = new List <JsTreeModel>();

            JsTreeModel[] treeModel = new JsTreeModel[10000];

            string[] turmaId = null;
            if (turma != null)
            {
                turmaId = turma.Split("|");
            }


            foreach (CursoAcadescViewModel pai in sorted)
            {
                var turmas = await _apiTurma.BuscarAsync(pai.Codigo);

                if (turmas.Count() > 0)
                {
                    JsTreeChildren[] filhos = new JsTreeChildren[turmas.Count()];
                    int i = 0;
                    foreach (var filho in turmas)
                    {
                        var     idNode      = filho.Serie.ToString() + '-' + filho.Turma.ToString() + '-' + filho.Turno.ToString() + '-' + filho.Ciclo.ToString();
                        Boolean selecionado = false;
                        if (turma != null)
                        {
                            foreach (var item in turmaId)
                            {
                                if (item == idNode)
                                {
                                    selecionado = true;
                                    break;
                                }
                            }
                        }
                        filhos[i] = new JsTreeChildren {
                            text = filho.Nome, id = idNode, state = new JsTreeState {
                                opened = true, selected = selecionado, disabled = false
                            }
                        };
                        i++;
                    }


                    child.Add(new JsTreeModel
                    {
                        text     = pai.Nome,
                        id       = pai.Codigo,
                        parent   = "#",
                        children = filhos
                    }
                              );
                }
                else
                {
                    child.Add(new JsTreeModel
                    {
                        text   = pai.Nome,
                        id     = pai.Codigo,
                        parent = "#"
                    }
                              );
                }
            }
            treeModel = child.ToArray();

            nodes.Add(
                new JsTreeRoot
            {
                text     = "Todas as Turmas",
                children = treeModel
            }
                );

            return(nodes);
        }
        public async Task <IActionResult> Index()
        {
            var model = await _api.BuscarAsync();

            return(View(model.OrderBy(t => t.Nome)));
        }