Exemplo n.º 1
0
        public NoteFileContent DeleteFile(string userId, string fileId, string path)
        {
            NoteFileContent file = _noteRepository.DeleteFile(Guid.Parse(userId), Guid.Parse(fileId));

            path = GetFilePath(path, file.FileType);

            FileInfo fileInfo = new FileInfo($"{path}/{file.FileName}");

            if (fileInfo.Exists)
            {
                File.Delete($"{path}/{file.FileName}");
            }

            return(file);
        }
Exemplo n.º 2
0
        public byte[] GetFile(string userId, string fileId, string path)
        {
            NoteFileContent file = _noteRepository.GetFile(Guid.Parse(userId), Guid.Parse(fileId));

            path = GetFilePath(path, file.FileType);

            FileInfo fileInfo = new FileInfo($"{path}/{file.FileName}");

            if (fileInfo.Exists)
            {
                return(File.ReadAllBytes($"{path}/{file.FileName}"));
            }
            else
            {
                throw new Exception("No file");
            }
        }
Exemplo n.º 3
0
 public FileWithContent(NoteFileContent file, byte[] content)
 {
     File    = file;
     Content = content;
 }