Example #1
0
        public IActionResult Salvar1(CurriculoViewModel curriculo, string id)
        {
            try
            {
                CurriculoDAO dao = new CurriculoDAO();

                if (curriculo.cpf == null)
                {
                    curriculo.cpf = id;
                }

                // ValidaDadosPessoal(curriculo.cpf);


                if (curriculo.complementoEnd == null)
                {
                    curriculo.complementoEnd = "";
                }

                if (dao.Consulta(curriculo.cpf) == null)
                {
                    dao.Inserir1(curriculo);
                    CurriculoViewModel Select = dao.Consulta(curriculo.cpf);
                    return(RedirectToAction("CadastroFormacao", Select));
                }

                else
                {
                    dao.Alterar1(curriculo);
                    CurriculoViewModel Select = dao.Consulta(curriculo.cpf);
                    return(View("CadastroEditarFormacao", Select));
                }
            }
            catch (Exception erro)
            {
                return(View("Error", new ErrorViewModel(erro.ToString())));
            }
        }