public async Task <ActionResult> GetDocumentById(Guid documentId)
        {
            var result = await documentsInteractor.GetDocumentByIdAsync(currentUserInformation.UserId, documentId);

            if (result == null)
            {
                return(NotFound(documentId));
            }

            return(File(result.Content, result.MimeType, result.FileName));
        }
Example #2
0
        public async Task <ActionResult> DownloadDocumentById(string shareKey, Guid documentId)
        {
            var share = await shareRepository.GetByShareKeyAsync(shareKey);

            if (share == null)
            {
                return(BadRequest($"Share with share key {shareKey} not found!"));
            }

            var result = await documentsInteractor.GetDocumentByIdAsync(share.SharingUserId, documentId);

            if (result == null)
            {
                return(NotFound(documentId));
            }

            return(File(result.Content, result.MimeType, result.FileName));
        }