public ActionResult Post(string carName) { try { GetCar getCar = new GetCar(); ApiResult result = new ApiResult(); IAuto car = getCar.GetCarByName(carName); if (car is NullCar) { return(NotFound()); } result.CarName = car.Name; result.Color = car.GetColor(); result.Year = car.GetYear(); return(Ok(result)); } catch (Exception ex) { _logger.LogError(ex.ToString()); return(StatusCode(StatusCodes.Status500InternalServerError)); } }