public bool ChangeHotChairLevel(int id, HotChairLevel newLevel) { Car car = _carService.GetCar(id); if (car == null) { return(false); } car.HotChairLevel = newLevel; _context.Entry(car).State = EntityState.Modified; _context.SaveChanges(); return(true); }
public IActionResult ChangeHotChairLevel([FromRoute] int id, [FromBody] HotChairLevel level) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!_acService.ChangeHotChairLevel(id, level)) { return(NotFound(new { message = "Car with given ID not found" })); } return(NoContent()); }