Exemplo n.º 1
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));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,PessoaId,ProfissaoId")] ProfissaoPessoa profissaoPessoa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(profissaoPessoa);
                await _context.SaveChangesAsync();

                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));
        }
Exemplo n.º 3
0
 public void Atualizar(ProfissaoPessoa Objeto)
 {
     _IProfissaoPessoa.Atualizar(Objeto);
 }
Exemplo n.º 4
0
 public void Excluir(ProfissaoPessoa Objeto)
 {
     _IProfissaoPessoa.Excluir(Objeto);
 }
Exemplo n.º 5
0
 public void Adicionar(ProfissaoPessoa Objeto)
 {
     _IProfissaoPessoa.Adicionar(Objeto);
 }