Esempio n. 1
0
        public IActionResult Salvar2(CurriculoViewModel curriculo, string id)
        {
            try
            {
                CurriculoDAO dao = new CurriculoDAO();

                if (curriculo.curso1 == null)
                {
                    curriculo.curso1 = "";
                }
                if (curriculo.curso2 == null)
                {
                    curriculo.curso2 = "";
                }
                if (curriculo.curso3 == null)
                {
                    curriculo.curso3 = "";
                }
                if (curriculo.curso4 == null)
                {
                    curriculo.curso4 = "";
                }
                if (curriculo.curso5 == null)
                {
                    curriculo.curso5 = "";
                }
                if (curriculo.cpf == null)
                {
                    curriculo.cpf = id;
                }

                if (dao.Consulta(curriculo.cpf) == null)
                {
                    dao.Inserir2(curriculo);
                    CurriculoViewModel Select = dao.Consulta(id);
                    return(View("CadastroEditarExpProf", Select));
                    //return RedirectToAction("CadastroExpProf", curriculo);
                }

                else
                {
                    dao.Inserir2(curriculo);
                    CurriculoViewModel Select = dao.Consulta(id);
                    return(View("CadastroEditarExpProf", Select));
                    //return RedirectToAction("CadastroEditarExpProf", curriculo);
                }
            }
            catch (Exception erro)
            {
                return(View("Error", new ErrorViewModel(erro.ToString())));
            }
        }