public async Task <IActionResult> Edit(int id, [Bind("FuncionarioId,Nome,Servico,Email,Telemovel")] 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));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ProfessorID,Nome,Email,Telemovel,Numero_De_Professor,Numero_De_Gabinete")] 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));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("ServicoId,Nome,Descricao,Localizacao")] Servico servico)
        {
            if (id != servico.ServicoId)
            {
                return(NotFound());
            }

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