示例#1
0
        public HttpResponseMessage Usercars(string id)
        {
            HttpResponseMessage responseMessage;
            JSend json;

            var list = _carModel.GetAllUserCars(id);

            if (list.Count > 0)
            {
                json            = new JSendData <CarDTO>("success", list);
                responseMessage = Request.CreateResponse(HttpStatusCode.OK, json);
            }
            else
            {
                json            = new JSendMessage("fail", "No items found");
                responseMessage = Request.CreateResponse(HttpStatusCode.NotFound, json);
            }

            return(responseMessage);
        }