public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Idade,Cpf,Sexo")] Pessoa pessoa)
        {
            if (id != pessoa.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pessoa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PessoaExists(pessoa.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pessoa));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,NomeCurso,IdCliente")] Curso curso)
        {
            if (id != curso.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(curso);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CursoExists(curso.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCliente"] = new SelectList(_context.Cliente, "ID", "CPF", curso.IdCliente);
            return(View(curso));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,InfoProgramadorId,Ionic,ReactJS,ReactNative,Android,Flutter,Swift,Ios,Html,Css,Bootstrap,Jquery,AngularJs1,Angular,Java,Python,AspMvc,AspWebForm,C,Csharp,NodeJS,ExpressNode,Cake,Djanto,Majento,Php,Vue,Ruby,MySqlServer,MySql,Salesforce,Photoshop,Ilustrator,Seo,Laravel,Outros")] Habilidades habilidades)
        {
            if (id != habilidades.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(habilidades);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HabilidadesExists(habilidades.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["InfoProgramadorId"] = new SelectList(_context.InfoProgramador, "Id", "Estado", habilidades.InfoProgramadorId);
            return(View(habilidades));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome")] LocalVacinacao department)
        {
            if (id != department.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(department);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LocalVacinacaoExists(department.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(department));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome")] Cliente cliente)
        {
            if (id != cliente.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cliente);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClienteExists(cliente.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cliente));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Descricao")] Produto produto)
        {
            if (id != produto.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(produto);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProdutoExists(produto.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(produto));
        }
Ejemplo n.º 7
0
        public async Task<IActionResult> Edit(int id, [Bind("Id,Nome")] Agendamento agendamento)
        {
            if (id != agendamento.Id)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(agendamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AgendamentoExists(agendamento.Id))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                return RedirectToAction(nameof(Index));
            }
            return View(agendamento);
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,DataAbertura,IdProduto,IdCliente")] Rnc rnc)
        {
            if (id != rnc.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rnc);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RncExists(rnc.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdCliente"] = new SelectList(_context.Cliente, "Id", "Nome", rnc.IdCliente);
            ViewData["IdProduto"] = new SelectList(_context.Produto, "Id", "Descricao", rnc.IdProduto);
            return(View(rnc));
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,NumeroWhats,Linkedin,Local,Estado,Portifolio,HorarioManha,HorarioNoite,HorarioMadrugada,HorarioTarde,HorarioComercial,Salario")] InfoProgramador infoProgramador)
        {
            if (id != infoProgramador.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(infoProgramador);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!InfoProgramadorExists(infoProgramador.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(infoProgramador));
        }
        public async Task UpdateAsync(Paciente obj)
        {
            bool hasAny = await _context.Agendamento.AnyAsync(x => x.Id == obj.Id);

            if (!hasAny)
            {
                throw new NotFoundException("Id not found");
            }
            try
            {
                _context.Update(obj);
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException e)
            {
                throw new DbConcurrencyException(e.Message);
            }
        }
Ejemplo n.º 11
0
 public async Task <int> AtualizarCaminhao(Caminhao caminhao)
 {
     _context.Update(caminhao);
     return(await _context.SaveChangesAsync());
 }
Ejemplo n.º 12
0
 public void Atualizar(Categoria categoria)
 {
     _cadastroContext.Update(categoria);
 }