Ejemplo n.º 1
0
        public ActionResult Cadastro(ProvaViewsModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    Prova p = new Prova();
                    p.Nota  = model.Nota;
                    p.Aluno = _alunoBusiness.ObterAlunoPorId(int.Parse(model.AlunoId));

                    _business.CadastrarProva(p);

                    ViewBag.Mensagem = "Nota cadastrada com sucesso";
                    ModelState.Clear();
                }
                catch (Exception e)
                {
                    ViewBag.Mensagem = e.Message;
                }
            }

            var alunos = _alunoBusiness.ConsultarAlunos();

            var vieModel = new ProvaViewsModel()
            {
                AlunoList = new Config.Config().retornaSelectListItem(alunos)
            };

            return(View(vieModel));
        }
Ejemplo n.º 2
0
        // GET: Prova
        public ActionResult Cadastro()
        {
            var alunos = _alunoBusiness.ConsultarAlunos();

            var vieModel = new ProvaViewsModel()
            {
                AlunoList = new Config.Config().retornaSelectListItem(alunos)
            };

            return(View(vieModel));
        }