Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("TarefaId,NomeTarefa,NomeOrdena,FuncionarioId,DataInicio,DataFim,TipoId,Descricao,estadoTarefa")] 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.Funcionario, "FuncionarioId", "Nome", tarefa.FuncionarioId);
            ViewData["TipoId"]        = new SelectList(_context.TipoTarefa, "TipoId", "TipoNome", tarefa.TipoId);
            return(View(tarefa));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("DepartamentoId,Nome")] Departamento departamento)
        {
            if (id != departamento.DepartamentoId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(departamento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DepartamentosExists(departamento.DepartamentoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                ViewBag.Mensagem = "Informação do departamento atualizada com sucesso";
                return(View("Success"));
            }
            return(View(departamento));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("FuncionarioId,Nome,Telemovel,CC,Email,CargoId,DepartamentoId")] 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("NoteE", funcionario));
            }
            ViewData["CargoId"]        = new SelectList(_context.Cargo.OrderBy(c => c.Nome), "CargoId", "Nome", funcionario.CargoId);
            ViewData["DepartamentoId"] = new SelectList(_context.Departamento.OrderBy(d => d.Nome), "DepartamentoId", "Nome", funcionario.DepartamentoId);
            return(View(funcionario));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("CargoId,Nome")] 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("NoteE", cargo));
            }
            return(View(cargo));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("FuncionarioId,Nome,SobreNome,Sexo,NTelemovel,Email,DepartamentoId,CargoId")] Funcionario funcionario)
        {
            if (id != funcionario.FuncionarioId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(funcionario);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FuncionariosExists(funcionario.FuncionarioId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                ViewBag.Mensagem = "Informação do funcionario atualizada com sucesso";
                return(View("Success"));
            }
            ViewData["DepartamentoId"] = new SelectList(_context.Departamento, "DepartamentoId", "Nome", funcionario.DepartamentoId);
            ViewData["CargoId"]        = new SelectList(_context.Cargo, "CardoId", "NomeCargo", funcionario.CargoId);
            return(View(funcionario));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ServicoId,Nome")] 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(View("NoteEditarS", servico));
                //return RedirectToAction(nameof(Index));
            }
            return(View(servico));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Edit(int id, [Bind("TipoId,TipoNome")] TipoTarefa tipoTarefa)
        {
            if (id != tipoTarefa.TipoId)
            {
                return(NotFound());
            }

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