コード例 #1
0
        public async Task <HttpResponseMessage> DownloadDocumentMortgageCancel()
        {
            return(await ValidateAndHandleOperationExecutionAsync(async() =>
            {
                Guid requestId = new Guid();
                HttpResponseMessage response = null;

                var result = await _entitleDomainService.GetMortgageCancel(requestId);

                if (response != null)
                {
                    response = Request.CreateResponse(HttpStatusCode.OK);
                    var stream = new MemoryStream(result.Data);
                    response.Content = new StreamContent(stream);

                    response.Content.Headers.ContentType = new MediaTypeHeaderValue(HttpContants.ContentTypes.OctetStream);
                    response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue(HttpContants.ContentDisposition.Attachment)
                    {
                        FileName = result.FileName
                    };
                }
                else
                {
                    response = base.CreateStringResponseMessage(HttpStatusCode.NotFound, ResponseMessages.FileNotFound);
                }

                return response;
            }));
        }
コード例 #2
0
        public async Task <ActionResult> DownloadDocumentMortgageCancel(string RequestId)
        {
            var result = await _entitleDomainService.GetMortgageCancel(Guid.Parse(RequestId));

            var stream = new MemoryStream(result.Data);

            FileStreamResult archivo = null;

            archivo = File(stream, "application/pdf");

            return(archivo);
        }