Exemple #1
0
        public async Task DeleteAsync(DishEntity dish)
        {
            ArgumentNullException.ThrowIfNull(dish.RowKey);
            var partitionKey = "lye";
            var response     = await _dishTable.DeleteEntityAsync(partitionKey, dish.RowKey);

            _logger.LogInformation("Deleted dish with RowKey {RowKey} - Status: {HttpStatus}", dish.RowKey, response.Status);
        }
Exemple #2
0
        public async Task <DishEntity> InsertAsync(DishEntity dish)
        {
            if (dish.PartitionKey == null)
            {
                dish.PartitionKey = "lye";
            }
            if (dish.RowKey == null)
            {
                dish.RowKey = Guid.NewGuid().ToString();
            }

            var response = await _dishTable.AddEntityAsync(dish);

            _logger.LogInformation("Inserted new dish with RowKey {RowKey} - Status: {HttpStatus}", dish.RowKey, response.Status);
            var entity = await _dishTable.GetEntityAsync <DishEntity>(dish.PartitionKey, dish.RowKey);

            return(entity);
        }