コード例 #1
0
        public HttpResponseMessage GetCar(string carId)
        {
            Car car = carBusiness.GetCar(carId);

            if (car == null)
            {
                var       message = string.Format("Car not found");
                HttpError error   = new HttpError(message);

                return(Request.CreateResponse(HttpStatusCode.NotFound, error));
            }
            else
            {
                GetCarDto getCarDto = new GetCarDto(car);
                return(Request.CreateResponse(HttpStatusCode.OK, getCarDto));
            }
        }