public async Task <IActionResult> Edit(int id, [Bind("EmpresaID,Nome")] Empresa empresa) { if (id != empresa.EmpresaID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(empresa); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmpresaExists(empresa.EmpresaID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(empresa)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,ReleaseDate,Genre,Price")] Movie movie) { if (id != movie.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(movie); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MovieExists(movie.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Edit(int id, [Bind("FunçãoID,Cargo,EmpresaID")] Função função) { if (id != função.FunçãoID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(função); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FunçãoExists(função.FunçãoID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmpresaID"] = new SelectList(_context.Set <Empresa>(), "EmpresaID", "EmpresaID", função.EmpresaID); return(View(função)); }