Exemple #1
0
        public async Task <IActionResult> Edit(int id, [Bind("CargosId,NomeCargo,Funcao")] Cargos cargos)
        {
            if (id != cargos.CargosId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cargos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CargosExists(cargos.CargosId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cargos));
        }
        public async Task <IActionResult> Edit(int id, [Bind("TarefaId,NomeTarefa,DataTarefa,FuncionarioId")] 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["FuncionarioId"] = new SelectList(_context.Funcionarios, "FuncionarioId", "Nome", tarefa.FuncionarioId);
            return(View(tarefa));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ProfessorId,Nome,Telemovel,Email,Gabinete,Disciplina,Escola")] 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));
        }
        public async Task <IActionResult> Edit(int id, [Bind("EscolaId,NomeEscola")] Escola escola)
        {
            if (id != escola.EscolaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(escola);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EscolaExists(escola.EscolaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(escola));
        }
        public async Task <IActionResult> Edit(int id, [Bind("FuncionarioId,Nome,Numero,Escola,Morada,Email,Telemovel,NIF")] 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)));
            }
            return(View(funcionario));
        }
Exemple #6
0
        public async Task <IActionResult> Edit(int id, [Bind("professoresId,Nome,Numero,Email")] Professores professores)
        {
            if (id != professores.professoresId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(professores);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProfessoresExists(professores.professoresId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(professores));
        }
        public async Task <IActionResult> Edit(int id, [Bind("FuncionarioId,Nome,Email,CargosId")] 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["CargosId"] = new SelectList(_context.Cargos, "CargosId", "Funcao", funcionario.CargosId);
            return(View(funcionario));
        }