public async Task <IActionResult> PutCliente([FromRoute] int id, [FromBody] Cliente cliente) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cliente.Clienteid) { return(BadRequest()); } cliente.DtUpdate = DateTime.Now; _context.Entry(cliente).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ClienteExists(id)) { return(NotFound()); } else { throw; } } return(Ok(cliente)); }
public async Task <IActionResult> PutVeiculo([FromRoute] int id, [FromBody] Veiculo veiculo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != veiculo.Veiculoid) { return(BadRequest()); } veiculo.DtUpdate = DateTime.Now; _context.Entry(veiculo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VeiculoExists(id)) { return(NotFound()); } else { throw; } } return(Ok(veiculo)); }