Ejemplo n.º 1
0
        public async Task <Result> AddReceivedFile(Guid fileId, string folderName, string name, long size, int version, DateTime lastModifiedDate, string path, string host)
        {
            var folderCreation = await AddFolder(folderName);

            if (folderCreation.WasSuccessful)
            {
                var fileResult = await _fileRepository.AddReceivedFile(new File
                                                                       (
                                                                           fileId,
                                                                           folderCreation.Data,
                                                                           name,
                                                                           path,
                                                                           lastModifiedDate,
                                                                           size,
                                                                           FileSource.Remote,
                                                                           version
                                                                       ));

                var recipientResult = await _recipientRepository.AddRecipientToFolder(host, DummyAdress.Create(host), folderCreation.Data);

                return(fileResult.WasSuccessful && recipientResult.WasSuccessful
                                        ? Result.Success()
                                        : Result.Failure());
            }

            return(Result.Failure());
        }