public HttpResponseMessage UpdateCarinfo(CarUpdateDto carUpdateDto) { string carId = carUpdateDto.Car_ID; string parameter = carUpdateDto.Parameter; string value = carUpdateDto.Value; string ownerId = carBusiness.GetCar(carId).CarOwner.User_ID; if (!isUserIdEqualToLoggedInUser(ownerId)) { var message = string.Format("Permission denied"); HttpError err = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.Unauthorized, err)); } else { if (carBusiness.UpdateCarInfo(carId, parameter, value) == false) { var message = string.Format(carBusiness.CheckUpdateInput(carId, parameter, value)); HttpError error = new HttpError(message); return(Request.CreateResponse(HttpStatusCode.BadRequest, error)); } else { var message = string.Format($"{parameter} updated successfully"); return(Request.CreateResponse(HttpStatusCode.OK, message)); } } }