public async Task <IActionResult> PutCargo([FromRoute] int id, [FromBody] Cargo cargo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != cargo.Idcargo) { return(BadRequest()); } _context.Entry(cargo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CargoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutVehiculo([FromRoute] string id, [FromBody] Vehiculo vehiculo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != vehiculo.Placas) { return(BadRequest()); } _context.Entry(vehiculo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehiculoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }