Example #1
0
        public async Task <IActionResult> ViewImage(int id)
        {
            var document = _commonFacadeApiClient.GetDocument(id).Result;
            var file     = await _commonFacadeApiClient.GetDocumentFile(new FileMetadata { FileUNCPath = document.RelativePath });

            return(PartialView(file));
        }
Example #2
0
        public async Task <IActionResult> Download(int id)
        {
            if (id == 0)
            {
                return(Content("Id cannot be 0."));
            }
            var model = await _propertyFacadeApiClient.GetPropertyDocument(id);

            var document = await _commonApiClient.GetDocument(model.DocumentId);

            Stream stream;

            if (document.FileContent == null)
            {
                var file = await _commonApiClient.GetDocumentFile(new FileMetadata { FileUNCPath = document.RelativePath });

                stream = new MemoryStream(file.FileContent);
            }
            else
            {
                stream = new MemoryStream(document.FileContent);
            }

            return(File(stream, document.Name.GetContentType(), document.Name));
        }