Esempio n. 1
0
        public ActionResult Editar(int? id, string error)
        {
            try
            {
                PessoaDTO PessoaDTO;
                if (!id.HasValue || id == 0)
                {
                    PessoaDTO = new PessoaDTO { Ativo = true };
                }
                else
                {
                    PessoaDTO = _pessoaAppService.FindPessoa(id.Value);
                }

                return View(PessoaDTO);
            }
            catch (Exception ex)
            {
                return View("Error", ex);
            }
        }
Esempio n. 2
0
        public ActionResult POSTEditar(PessoaDTO PessoaDTO)
        {
            try
            {
                if (PessoaDTO.Id == 0)
                {
                    PessoaDTO = _pessoaAppService.AddPessoa(PessoaDTO);
                }
                else
                {
                    _pessoaAppService.UpdatePessoa(PessoaDTO);
                }

                return JavaScript(
                    "MensagemSucesso(' + mensagemSucesso + ');" +
                    "CarregarPaginaAjax('" + Url.Action("Index", "Pessoa") + "');");
            }
            catch (Exception ex)
            {
                TratamentoErro.Tratamento(this, ex);
                return View("Editar", PessoaDTO);
            }
        }