public async Task<IActionResult> Edit(int id, [Bind("Id,Nome,ResponsavelId")] Departamento departamento) { if (id != departamento.Id) { return NotFound(); } if (ModelState.IsValid) { try { _context.Update(departamento); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DepartamentoExists(departamento.Id)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } ViewData["ResponsavelId"] = new SelectList(_context.Funcionario, "Id", "Nome", departamento.ResponsavelId); return View(departamento); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Inicio,Fim,Titulo,Descricao")] Tarefa tarefa) { if (id != tarefa.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tarefa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TarefaExists(tarefa.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tarefa)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,DataNascimento, LotacaoId")] Funcionario funcionario) { if (id != funcionario.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(funcionario); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FuncionarioExists(funcionario.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(funcionario)); }