Exemple #1
0
        public HttpResponseMessage CarCreate(CarCreate request)
        {
            CarsService carsService = new CarsService();

            if (request == null)
            {
                ModelState.AddModelError("", "missing model");
            }

            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            var id = carsService.CarCreate(request);

            return(Request.CreateResponse(HttpStatusCode.Created, id));
        }