static internal async Task <CardTableEntry> SetupAddCard(this SessionRepository repository, Guid sessionId, Guid regionId, CardTableEntry.State initialState, String ownerId, UInt32 value) { var dataTable = repository.GetTableForSessionData(sessionId); CardTableEntry newCardEntry = new CardTableEntry(sessionId, regionId); newCardEntry.ValueRaw = (Int32)value; newCardEntry.OwnerId = ownerId; newCardEntry.OwnerStateRaw = (Int32)initialState; TableOperation insertOperation = TableOperation.InsertOrReplace(newCardEntry); await dataTable.ExecuteAsync(insertOperation); return(newCardEntry); }
private void SetCardInternal(IBatchOperationHandle batchOperationHandleInterface, Guid sessionId, Guid regionId, CardTableEntry.State newState, String newOwnerId, String currentEtag) { BatchOperationHandle batchOperationHandle = batchOperationHandleInterface as BatchOperationHandle; // Get the session data table CloudTable sessionDataTable = SessionRepository.GetTableForSessionData(TableClient, sessionId); // Create a DynamicTableEntity so that we can do a partial update of this table (a merge) DynamicTableEntity cardEntry = CardTableEntry.CreateDynamicTableEntity(sessionId, regionId, currentEtag); CardTableEntry.SetOwner(cardEntry, newState, newOwnerId); batchOperationHandle.BatchOperation.Merge(cardEntry); }