Last active
March 2, 2022 18:20
-
-
Save awswithdotnet/7b7c9d9168b862c9f49866bfba8b2583 to your computer and use it in GitHub Desktop.
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