Пример #1
0
 public async Task <ActionResult> PrintByFilter(int templateId, [FromQuery] GenerateMarkupByFilterArguments <int> args, CancellationToken cancellation)
 {
     return(await ControllerUtilities.InvokeActionImpl(async() =>
     {
         var service = GetFactService();
         var(fileBytes, fileName) = await service.PrintByFilter(templateId, args, cancellation);
         var contentType = ControllerUtilities.ContentType(fileName);
         return File(fileContents: fileBytes, contentType: contentType, fileName);
     }, _logger));
 }
Пример #2
0
        public async Task <ActionResult <MarkupPreviewResponse> > PreviewByFilter([FromBody] MarkupPreviewTemplate entity, [FromQuery] GenerateMarkupByFilterArguments <object> args, CancellationToken cancellation)
        {
            return(await ControllerUtilities.InvokeActionImpl(async() =>
            {
                var(body, downloadName) = await _service.PreviewByFilter(entity, args, cancellation);

                // Prepare and return the response
                var response = new MarkupPreviewResponse
                {
                    Body = body,
                    DownloadName = downloadName
                };

                return Ok(response);
            },
                                                              _logger));
        }