public async Task AddItemToDynamoDBTable3(GameRecord3 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> AddNewRecord3([FromBody] GameRecord3 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.AddItemToDynamoDBTable3(model); return(Ok()); } else { return(BadRequest(ModelState)); } }