示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("CargosId,Nome,Superior")] 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;
                    }
                }
                ViewBag.Message = "Setor editado com sucesso!";
                return(View("ViewSUCESSSO"));
            }
            return(View(cargos));
        }
        public async Task<IActionResult> Edit(int id, [Bind("Nome,ColaboradoresId,Profissao,DataNascimento,email")] Colaboradores colaboradores)
        {

            if (id != colaboradores.ColaboradoresId)
            {
                return NotFound();
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(colaboradores);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ColaboradoresExists(colaboradores.ColaboradoresId))
                    {
                        return NotFound();
                    }
                    else
                    {
                        throw;
                    }
                }
                ViewBag.Message = "Colaborador editado com sucesso!";
                return RedirectToAction(nameof(Index));
            }
            return View(colaboradores);
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("SetorId,Nome,Local")] Setor setor)
        {
            if (id != setor.SetorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(setor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SetorExists(setor.SetorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                ViewBag.Message = "Setor editado com sucesso!";
                return(View("ViewSUCESSSO"));
            }
            return(View(setor));
        }