Exemplo n.º 1
0
        // GET /api/cars/{id}
        public Car GetCar(UriParameter uriParameter)
        {
            var carTuple = _carsCtx.GetSingle(uriParameter.Id);

            if (!carTuple.Item1)
            {
                var response = Request.CreateResponse(HttpStatusCode.NotFound);
                throw new HttpResponseException(response);
            }

            return(carTuple.Item2);
        }
        // GET /api/cars/{id}
        public Car GetCar(UriParameter uriParameter) {

            var carTuple = _carsCtx.GetSingle(uriParameter.Id);

            if (!carTuple.Item1) {

                var response = Request.CreateResponse(HttpStatusCode.NotFound);
                throw new HttpResponseException(response);
            }

            return carTuple.Item2;
        }