public async Task <IActionResult> PutVehiculeType(int id, VehiculeType vehiculeType) { if (id != vehiculeType.Id) { return(BadRequest()); } _context.Entry(vehiculeType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehiculeTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <bool> UpdateEmergencyState(int carId, bool newEmergencyState) { Car car = await _context.Cars.FindAsync(carId); if (car == null) { return(false); } car.IsEmergencyOn = newEmergencyState; _context.Entry(car).State = EntityState.Modified; await _context.SaveChangesAsync(); return(true); }