public void DeleteFile(File file) { _dbContext.Files.Remove(file); var path = _configuration["StoragePath"] + $@"{_}Storage{_}{file.Id}.dat"; if (System.IO.File.Exists(path)) { System.IO.File.Delete(path); } }
private long GetFileSize(File file) { var path = _configuration["StoragePath"] + $@"{_}Storage{_}{file.Id}.dat"; if (System.IO.File.Exists(path)) { return(new FileInfo(path).Length); } else { return(0); } }
private long GetFileSizeWithCache(File file) { return(_cache.GetAndCache($"file-size-cache-id-{file.Id}", () => GetFileSize(file))); }