Ejemplo n.º 1
0
        public async Task DeleteFile(File file)
        {
            _dbContext.Files.Remove(file);
            var haveDaemon = await _dbContext.Files.Where(f => f.Id != file.Id).AnyAsync(f => f.HardwareId == file.HardwareId);

            if (!haveDaemon)
            {
                _storageProvider.Delete(file.HardwareId);
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <ImageModel> > DeleteImage([FromRoute] Guid uid)
        {
            var image = await database.Get <ImageModel>(uid);

            if (image == null || (image.OwnerUid != authClaims.UserUid && !authClaims.User.IsAdmin.Equals(true)))
            {
                return(NotFound());
            }

            await database.Delete <ImageModel>(uid);

            await storage.Delete(image.Bucket, image.BlobName);

            return(NoContent());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条或一组记录
        /// </summary>
        /// <param name="table"></param>
        /// <param name="filter"></param>
        /// <param name="data">需要删除的记录</param>
        /// <returns>返回删除行数</returns>
        public virtual int delete(string table, object filter, params object[] data)
        {
            IStorageProvider provider = this.getProvider(_cfg);

            return(provider.Delete(table, filter, getEntities(data)));
        }
Ejemplo n.º 4
0
 public void Delete(string id)
 {
     storageProvider.Delete(id);
 }
 public bool Delete(Guid id, string filename)
 {
     return(storageProvider.Delete(id, filename));
 }