public async Task <IActionResult> Edit(int id, [Bind("AcaoId,AcaoChamadoid,AcaoDescricao,AcaoAtendenteid,AcaoDepartamentoid,AcaoCategoriaid")] AcaoChamado acaoChamado) { if (id != acaoChamado.AcaoId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(acaoChamado); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AcaoChamadoExists(acaoChamado.AcaoId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AcaoAtendenteid"] = new SelectList(_context.Atendente, "AteId", "AteId", acaoChamado.AcaoAtendenteid); ViewData["AcaoCategoriaid"] = new SelectList(_context.Categoria, "CatId", "CatNome", acaoChamado.AcaoCategoriaid); ViewData["AcaoChamadoid"] = new SelectList(_context.Chamado, "ChaId", "ChaCriador", acaoChamado.AcaoChamadoid); ViewData["AcaoDepartamentoid"] = new SelectList(_context.Departamento, "DepId", "DepEmail", acaoChamado.AcaoDepartamentoid); return(View(acaoChamado)); }
public async Task <IActionResult> Create([Bind("AcaoId,AcaoChamadoid,AcaoDescricao,AcaoAtendenteid,AcaoDepartamentoid,AcaoCategoriaid")] AcaoChamado acaoChamado) { if (ModelState.IsValid) { _context.Add(acaoChamado); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["AcaoAtendenteid"] = new SelectList(_context.Atendente, "AteId", "AteId", acaoChamado.AcaoAtendenteid); ViewData["AcaoCategoriaid"] = new SelectList(_context.Categoria, "CatId", "CatNome", acaoChamado.AcaoCategoriaid); ViewData["AcaoChamadoid"] = new SelectList(_context.Chamado, "ChaId", "ChaCriador", acaoChamado.AcaoChamadoid); ViewData["AcaoDepartamentoid"] = new SelectList(_context.Departamento, "DepId", "DepEmail", acaoChamado.AcaoDepartamentoid); return(View(acaoChamado)); }