public static void AddVote(string vote_id, string tag, string title, string user_name) { string partition_key = Consts.TAG_NAME_KEY_PREFIX + tag.ToLowerInvariant(); NextIdStore.CreateIfNotExists(Warehouse.TagScrollsTable, partition_key, 0); int next_id = NextIdStore.Next(Warehouse.TagScrollsTable, partition_key); DynamicTableEntity entity = buildEntity(tag, next_id); entity["voteid"] = new EntityProperty(vote_id); entity["title"] = new EntityProperty(title); entity[Consts.WHO_PROP_NAME] = new EntityProperty(user_name); entity[Consts.TIME_PROP_NAME] = new EntityProperty(DateTimeOffset.UtcNow); Warehouse.TagScrollsTable.Execute(TableOperation.Insert(entity)); Warehouse.TagScrollsPond.AddOrUpdate(entity.PartitionKey, entity.RowKey, entity); }
public static string CreatePaper(string user_name) { for (; ;) { string vote_id = Util.RandomAlphaNumericString(8); if (NextIdStore.CreateIfNotExists(Warehouse.PapersTable, vote_id, 0)) { createAction(vote_id, user_name, new ActionData() { mat = "infos-create" }); return(vote_id); } } }