Ejemplo n.º 1
0
        public HttpResponseMessage Post(CarDetailsDTO carDetailsDto)
        {
            HttpResponseMessage responseMessage;
            JSendMessage        json;
            var response = _carModel.AddCar(carDetailsDto);

            if (response)
            {
                json            = new JSendMessage("success", "Car successfully added");
                responseMessage = Request.CreateResponse(HttpStatusCode.OK, json);
            }
            else
            {
                json            = new JSendMessage("fail", "Something bad happened");
                responseMessage = Request.CreateResponse(HttpStatusCode.BadRequest, json);
            }

            return(responseMessage);
        }