Esempio n. 1
0
        public async Task <IActionResult> DeleteTags(
            [HttpTrigger(AuthorizationLevel.Anonymous, nameof(HttpMethods.Delete), Route = "{userId}/" + BasePath + "/{id}")] HttpRequest httpRequest,
            [Table(TableNames.Tag)] CloudTable cloudTable,
            string userId,
            Guid id,
            ILogger logger)
        {
            if (await httpRequest.Authenticate(SecurityOptions, userId, logger) == AuthenticationStatus.Unauthenticated)
            {
                return(new UnauthorizedResult());
            }

            try
            {
                var model = cloudTable.DeleteEntity <TagTableEntity>(userId, id.ToString());

                if (model == null)
                {
                    return(new NotFoundResult());
                }

                return(new OkObjectResult(model.MapTo()));
            }
            catch (StorageException ex) when(ex.RequestInformation.HttpStatusCode == 404)
            {
                return(new NotFoundResult());
            }
        }
        /// <summary>
        /// Delete a record
        /// </summary>
        /// <param name="record">The record to delete</param>
        public void Delete(T record)
        {
            EnsureRecord(record);

            CloudTable.DeleteEntity(record.PartitionKey, record.RowKey);
        }
        /// <summary>
        /// Delete a record
        /// </summary>
        /// <param name="record">The record to delete</param>
        public void Delete <T>(T record) where T : class, ITableEntity
        {
            EnsureRecord(record);

            CloudTable.DeleteEntity(record.PartitionKey, record.RowKey);
        }
Esempio n. 4
0
 public Task Delete(ITableEntity entity)
 {
     return(_table.DeleteEntity(entity));
 }