public async Task <IActionResult> Edit(int id, [Bind("Id,AnoModelo,AnoFabricacao,Placa,Chassi,Marca,Modelo,Combustivel,QuantidadePortas,CilindradaMotor")] Carro carro) { if (id != carro.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(carro); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CarroExists(carro.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(carro)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Cpf,Rg")] Cliente cliente) { if (id != cliente.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(cliente); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(cliente.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(cliente)); }