Exemplo n.º 1
0
 public IActionResult Delete(string id)
 {
     _repo.Delete(new Item()
     {
         Id = id
     }).Wait();
     return(Ok());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Deletes a single row
        /// <param name="storage">Table storage reference</param>
        /// <param name="tableName">Table name, required.</param>
        /// <param name="rowId">Row ID to delete, required.</param>
        /// </summary>
        public static void Delete(this ITableStorage storage, string tableName, TableRowId rowId)
        {
            if (rowId == null)
            {
                return;
            }

            storage.Delete(tableName, new[] { rowId });
        }
Exemplo n.º 3
0
        public async Task <AdminConfigResponse> Update(AdminConfigResponse entity)
        {
            var adminConfig = new AdminConfiguration
            {
                RowKey          = entity.ConfigId.ToString(),
                PartitionKey    = PartitionKey.AdminConfiguration,
                ConfigId        = entity.ConfigId.ToString(),
                FlagName        = entity.FlagName,
                FlagDescription = entity.FlagDescription,
                FlagValue       = entity.FlagValue.ToString(),
            };
            await _storage.Update <AdminConfiguration>(TableStorageEntityType.AdminConfiguration, adminConfig);

            var existingData = await _storage.GetAll <AllowExtenedUser>(TableStorageEntityType.AllowExtenedUser, entity.ConfigId.ToString());

            foreach (var data in existingData)
            {
                await _storage.Delete <AllowExtenedUser>(TableStorageEntityType.AllowExtenedUser, data);
            }

            if (entity.FlagValue == Allow.AllOff && entity.UserId != null)
            {
                var chunkedList = this.ChunkBy(entity.UserId, 100).Select(e => string.Join(",", e)).ToList();

                foreach (var chunk in chunkedList)
                {
                    var user = new AllowExtenedUser
                    {
                        RowKey       = Guid.NewGuid().ToString(),
                        PartitionKey = entity.ConfigId.ToString(),
                        UserId       = chunk
                    };
                    await _storage.Update <AllowExtenedUser>(TableStorageEntityType.AllowExtenedUser, user);
                }
            }
            return(entity);
        }
Exemplo n.º 4
0
        public void Write(string key, string value)
        {
            var rowId = new TableRowId(_partitionKey, key);

            if (value == null)
            {
                _tableStorage.Delete(_tableName, rowId);
            }
            else
            {
                var row = new TableRow(rowId);
                row["value"] = value;
                _tableStorage.InsertOrReplace(_tableName, row);
            }
        }
Exemplo n.º 5
0
 private void DeleteTestEntity(TableEntity entity)
 {
     storage.Delete(entity);
 }
Exemplo n.º 6
0
 public void Dispose()
 {
     storage.Delete().Wait();
 }
Exemplo n.º 7
0
        public override void Dispose()
        {
            _tables.Delete(_tableName);

            _tables.Dispose();

            Cleanup();

            base.Dispose();
        }