Esempio n. 1
0
        public ActionResult Index()
        {
            int     idUsuario = Convert.ToInt32(HttpContext.User.Identity.Name);
            Usuario user      = new MUsuario().BringOne(c => c.idUsuario == idUsuario);
            Aluno   aluno     = user.Aluno.FirstOrDefault();
            List <InscricaoTurma>             turmasAluno    = aluno.InscricaoTurma.ToList();
            MControleNotas                    mControleNotas = new MControleNotas();
            List <ListagemMedsAlunoViewModel> viewModel      = new List <ListagemMedsAlunoViewModel>();

            foreach (var med in turmasAluno)
            {
                var itemAdciononar = new ListagemMedsAlunoViewModel
                {
                    descMed         = med.Turma.Med.descMed,
                    descSemestre    = med.ControleNotas.FirstOrDefault().Modulo.Semestre.descSemestre,
                    idMed           = med.Turma.idMed,
                    notas           = new double[] { 0, 0, 0 },
                    idControleNotas = new int[] { 0, 0, 0 }
                };
                for (int i = 0; i < med.ControleNotas.Count; i++)
                {
                    itemAdciononar.notas[i]           = mControleNotas.RetornaNota(med.ControleNotas.ElementAt(i).idControleNotas);
                    itemAdciononar.idControleNotas[i] = med.ControleNotas.ElementAt(i).idControleNotas;
                }
                viewModel.Add(itemAdciononar);
            }
            return(View(viewModel));
        }
Esempio n. 2
0
        public ActionResult GerenciarNotas(int idMed)
        {
            Med med = new MMed().BringOne(c => c.idMed == idMed);

            ViewBag.idMed           = idMed;
            ViewBag.descMedSemestre = med.descMed + " - " + med.Semestre.descSemestre;
            List <Turma>          listTurmas          = new MTurma().Bring(c => c.idMed == idMed);
            List <InscricaoTurma> listAlunosInscritos = new List <InscricaoTurma>();
            MInscricaoTurma       mInscricaoTurma     = new MInscricaoTurma();

            foreach (var turma in listTurmas)
            {
                listAlunosInscritos.AddRange(mInscricaoTurma.Bring(c => c.idTurma == turma.idTurma));
            }
            List <GerenciarNotasViewModel> listGerenciaNotas = new List <GerenciarNotasViewModel>();
            MControleNotas mControleNotas = new MControleNotas();

            foreach (var alunoInscrito in listAlunosInscritos)
            {
                GerenciarNotasViewModel notasAluno = new GerenciarNotasViewModel();
                notasAluno.controleNotas = new List <ControleNotasViewModel>();
                foreach (var controleNotas in alunoInscrito.ControleNotas)
                {
                    notasAluno.controleNotas.Add(new ControleNotasViewModel()
                    {
                        controleNotas = controleNotas,
                        nota          = mControleNotas.RetornaNota(controleNotas.idControleNotas)
                    });
                }
                notasAluno.aluno = alunoInscrito;
                listGerenciaNotas.Add(notasAluno);
            }
            return(View(listGerenciaNotas));
        }