public async Task AddItemToDynamoDBTable2(GameRecord2 record) { DynamoDBContextConfig config = new DynamoDBContextConfig { ConsistentRead = false, Conversion = DynamoDBEntryConversion.V2 }; using (DynamoDBContext context = new DynamoDBContext(client, config)) { await context.SaveAsync(record); } }
public async Task <IActionResult> AddNewRecord2([FromBody] GameRecord2 model) { if (ModelState.IsValid) { //Generate Unique ID---------------------------------------------------- var rfc4122bytes = Convert.FromBase64String("aguidthatIgotonthewire=="); Array.Reverse(rfc4122bytes, 0, 4); Array.Reverse(rfc4122bytes, 4, 2); Array.Reverse(rfc4122bytes, 6, 2); var guid = new Guid(rfc4122bytes); //---------------------------------------------------------------------- model.Id = guid.ToString(); //assign to model await _highscoresService.AddItemToDynamoDBTable2(model); return(Ok()); } else { return(BadRequest(ModelState)); } }