예제 #1
0
        public HttpResponseMessage GetCar(int id)
        {
            HttpResponseMessage responseMessage;
            JSend json;
            var   carDetails = _carModel.GetCarDetails(id);

            if (null != carDetails)
            {
                json = new JSendData <CarDetailsDTO>("success", new List <CarDetailsDTO> {
                    carDetails
                });
                responseMessage = Request.CreateResponse(HttpStatusCode.OK, json);
            }
            else
            {
                json            = new JSendMessage("fail", "No items found");
                responseMessage = Request.CreateResponse(HttpStatusCode.NotFound, json);
            }

            return(responseMessage);
        }