Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("TelefoneTipoId,Descricao")] TelefoneTipo telefoneTipo)
        {
            if (id != telefoneTipo.TelefoneTipoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telefoneTipo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelefoneTipoExists(telefoneTipo.TelefoneTipoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(telefoneTipo));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PessoaId,EnderecoId")] EnderecoPessoa enderecoPessoa)
        {
            if (id != enderecoPessoa.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(enderecoPessoa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnderecoPessoaExists(enderecoPessoa.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EnderecoId"] = new SelectList(_context.Enderecos, "EnderecoId", "Bairro", enderecoPessoa.EnderecoId);
            ViewData["PessoaId"]   = new SelectList(_context.Pessoa, "PessoaId", "Nome", enderecoPessoa.PessoaId);
            return(View(enderecoPessoa));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, [Bind("ProfissaoId,Nome,Descricao,CBO")] Profissao profissao)
        {
            if (id != profissao.ProfissaoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profissao);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfissaoExists(profissao.ProfissaoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(profissao));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("ContatoId,PessoaId,EmailId,TelefoneId,EnderecoId")] Contato contato)
        {
            if (id != contato.ContatoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(contato);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ContatoExists(contato.ContatoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmailId"]    = new SelectList(_context.Emails, "EmailId", "EnderecoEmail", contato.EmailId);
            ViewData["EnderecoId"] = new SelectList(_context.Enderecos, "EnderecoId", "Bairro", contato.EnderecoId);
            ViewData["PessoaId"]   = new SelectList(_context.Pessoa, "PessoaId", "Nome", contato.PessoaId);
            ViewData["TelefoneId"] = new SelectList(_context.Telefone, "TelefoneId", "Numero", contato.TelefoneId);
            return(View(contato));
        }
Esempio n. 5
0
        public async Task <IActionResult> Edit(int id, [Bind("PessoaTipoId,PessoaId,Nome,Sobrenome")] Pessoa pessoa)
        {
            if (id != pessoa.PessoaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pessoa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PessoaExists(pessoa.PessoaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PessoaTipoId"] = new SelectList(_context.PessoaTipo, "Id", "Descricao", pessoa.PessoaTipoId);
            return(View(pessoa));
        }
Esempio n. 6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,PessoaId,ProfissaoId")] ProfissaoPessoa profissaoPessoa)
        {
            if (id != profissaoPessoa.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(profissaoPessoa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfissaoPessoaExists(profissaoPessoa.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PessoaId"]    = new SelectList(_context.Pessoa, "PessoaId", "Nome", profissaoPessoa.PessoaId);
            ViewData["ProfissaoId"] = new SelectList(_context.Profissao, "ProfissaoId", "CBO", profissaoPessoa.ProfissaoId);
            return(View(profissaoPessoa));
        }
Esempio n. 7
0
        public async Task <IActionResult> Edit(int id, [Bind("DepartamentoId,Nome")] Departamento departamento)
        {
            if (id != departamento.DepartamentoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartamentoExists(departamento.DepartamentoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(departamento));
        }
Esempio n. 8
0
        public async Task <IActionResult> Edit(int id, [Bind("PessoaId,JuridicaId,NomeFantasia,RazaoSocial,Cnpj,InscricaoEstadual,DataFundacao")] Juridica juridica)
        {
            if (id != juridica.JuridicaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(juridica);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!JuridicaExists(juridica.JuridicaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PessoaId"] = new SelectList(_context.Pessoa, "PessoaId", "Nome", juridica.PessoaId);
            return(View(juridica));
        }
Esempio n. 9
0
        public async Task <IActionResult> Edit(int id, [Bind("PessoaId,FisicaId,Cpf,Rg,DataNascimento")] Fisica fisica)
        {
            if (id != fisica.FisicaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(fisica);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FisicaExists(fisica.FisicaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PessoaId"] = new SelectList(_context.Pessoa, "PessoaId", "Nome", fisica.PessoaId);
            return(View(fisica));
        }
Esempio n. 10
0
        public async Task <IActionResult> Edit(int id, [Bind("EnderecoId,Descricao,Logradouro,Complemento,CEP,Bairro,Cidade,Estado")] Endereco endereco)
        {
            if (id != endereco.EnderecoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(endereco);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EnderecoExists(endereco.EnderecoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(endereco));
        }
Esempio n. 11
0
        public async Task <IActionResult> Edit(int id, [Bind("TelefoneId,Numero,TelefoneTipoId")] Telefone telefone)
        {
            if (id != telefone.TelefoneId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(telefone);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TelefoneExists(telefone.TelefoneId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TelefoneTipoId"] = new SelectList(_context.TelefoneTipo, "TelefoneTipoId", "Descricao", telefone.TelefoneTipoId);
            return(View(telefone));
        }
Esempio n. 12
0
        public async Task <IActionResult> Edit(int id, [Bind("EmailId,EnderecoEmail")] Email email)
        {
            if (id != email.EmailId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(email);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmailExists(email.EmailId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(email));
        }
Esempio n. 13
0
        public async Task <IActionResult> Edit(int id, [Bind("ClienteId,DataCadastro,Ativo,PessoaId")] Cliente cliente)
        {
            if (id != cliente.ClienteId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.ClienteId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PessoaId"] = new SelectList(_context.Pessoa, "PessoaId", "Nome", cliente.PessoaId);
            return(View(cliente));
        }