Example #1
0
        public IHttpActionResult PutVehicleToBatch(int Idbatch, Vehicle vehicle)
        {
            HttpResponseMessage response = null;

            try
            {
                if (ModelState.IsValid)
                {
                    string token = Request.Headers.GetValues("oauth_token").First();
                    batchService.AddVehicle(token, vehicle, Idbatch);
                    response = Request.CreateResponse(HttpStatusCode.Accepted);
                    return(Ok("Vehiculo agregado a lote con exito"));
                }
                else
                {
                    return(Content(HttpStatusCode.ExpectationFailed, "fallas en el modelo"));
                }
            }
            catch (Exception e)
            {
                return(Content(HttpStatusCode.ExpectationFailed, e.Message));
            }
        }