DynamoDB DynamoDB VehicleController.cs Post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public async Task<IActionResult> Post(Vehicle vehicle) | |
{ | |
Table table = Table.LoadTable(_client, "Vehicles"); | |
var vehicleDocument = new Document(); | |
vehicleDocument["VIN"] = vehicle.Vin; | |
vehicleDocument["YearManufactured"] = vehicle.Year; | |
vehicleDocument["Make"] = vehicle.Make; | |
vehicleDocument["Model"] = vehicle.Model; | |
await table.PutItemAsync(vehicleDocument); | |
return Created("/vehicle/" + vehicle.Vin, vehicle); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment