Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("TFCId,CargoID,FuncionarioId,TarefaId")] TFC tFC)
        {
            if (id != tFC.TFCId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tFC);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TFCExists(tFC.TFCId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CargoID"]       = new SelectList(_context.Cargo, "CargoId", "NomeCargo", tFC.CargoID);
            ViewData["FuncionarioId"] = new SelectList(_context.Funcionario, "FuncionarioId", "Nome", tFC.FuncionarioId);
            ViewData["TarefaId"]      = new SelectList(_context.Tarefa, "TarefaId", "NomeTarefa", tFC.TarefaId);
            return(View(tFC));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("DepartamentoId,NomeDepartamento")] 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));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("TarefaId,NomeTarefa,DescricaoTarefa,DataTarefa,CargoId")] Tarefa tarefa)
        {
            if (id != tarefa.TarefaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tarefa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TarefaExists(tarefa.TarefaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CargoId"] = new SelectList(_context.Cargo, "CargoId", "NomeCargo", tarefa.CargoId);
            return(View(tarefa));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("FuncionarioId,Nome,Contacto,DataNascimento,GeneroId,CargoId")] Funcionario funcionario)
        {
            if (id != funcionario.FuncionarioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(funcionario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FuncionarioExists(funcionario.FuncionarioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CargoId"]  = new SelectList(_context.Cargo, "CargoId", "NomeCargo", funcionario.CargoId);
            ViewData["GeneroId"] = new SelectList(_context.Genero, "GeneroId", "Genero", funcionario.GeneroId);
            return(View(funcionario));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("TarFuncId,FuncionarioId,TarefaId")] TarFunc tarFunc)
        {
            if (id != tarFunc.TarFuncId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tarFunc);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TarFuncExists(tarFunc.TarFuncId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FuncionarioId"] = new SelectList(_context.Funcionario, "FuncionarioId", "Nome", tarFunc.FuncionarioId);
            ViewData["TarefaId"]      = new SelectList(_context.Tarefa, "TarefaId", "DescricaoTarefa", tarFunc.TarefaId);
            return(View(tarFunc));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("CargoId,NomeCargo,Descricao,NivelCargo")] Cargo cargo)
        {
            if (id != cargo.CargoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cargo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CargoExists(cargo.CargoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cargo));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ProfessorId,Nome,Contacto,DataNascimento,GeneroId,DepartamentoId")] Professor professor)
        {
            if (id != professor.ProfessorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(professor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfessorExists(professor.ProfessorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(professor));
        }