public void Test_IncorrectDelete() { Vehicle prius = new Vehicle { Id = 60, Make = "Honda", Model = "Civic", Year = 1900 }; var vp = new VehicleActions(); vp.SaveVehicle(prius); }
/// <summary> /// Save the vehicle to the database /// </summary> /// <param name="vehicleToSave">The vehicle that is going to be save to the databse</param> /// <returns></returns> public HttpResponseMessage Post_Save_Vehicle([FromBody] Vehicle vehicleToSave) { VehicleActions v_action = new VehicleActions(); HttpResponseMessage response; int id = v_action.SaveVehicle(vehicleToSave); //Check that values for year, make and model are valid if (id == -1) { response = Request.CreateResponse(HttpStatusCode.NotAcceptable); return(response); } vehicleToSave.Id = id; response = Request.CreateResponse(HttpStatusCode.Created); response.Headers.Location = new Uri(Request.RequestUri, String.Format("/{0}", id)); return(response); }