Skip to content

Instantly share code, notes, and snippets.

@awswithdotnet
Last active March 2, 2022 18:20
Embed
What would you like to do?
DynamoDB DynamoDB VehicleController.cs Post
[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