public async Task <ActionResult> PrintById(TKey id, int templateId, [FromQuery] GenerateMarkupByIdArguments args, CancellationToken cancellation) { return(await ControllerUtilities.InvokeActionImpl(async() => { var service = GetFactGetByIdService(); var(fileBytes, fileName) = await service.PrintById(id, templateId, args, cancellation); var contentType = ControllerUtilities.ContentType(fileName); return File(fileContents: fileBytes, contentType: contentType, fileName); }, _logger)); }
public async Task <ActionResult <MarkupPreviewResponse> > PreviewById([FromRoute] string id, [FromBody] MarkupPreviewTemplate entity, [FromQuery] GenerateMarkupByIdArguments args, CancellationToken cancellation) { return(await ControllerUtilities.InvokeActionImpl(async() => { var(body, downloadName) = await _service.PreviewById(id, entity, args, cancellation); // Prepare and return the response var response = new MarkupPreviewResponse { Body = body, DownloadName = downloadName }; return Ok(response); }, _logger)); }