public async Task <ActionResult <MarkupPreviewResponse> > Preview([FromBody] MarkupPreviewTemplate entity, [FromQuery] GenerateMarkupArguments args, CancellationToken cancellation) { return(await ControllerUtilities.InvokeActionImpl(async() => { var(body, downloadName) = await _service.Preview(entity, args, cancellation); // Prepare and return the response var response = new MarkupPreviewResponse { Body = body, DownloadName = downloadName }; return Ok(response); }, _logger)); }
public async Task <(string Body, string DownloadName)> Preview(MarkupPreviewTemplate entity, GenerateMarkupArguments args, CancellationToken cancellation) { // Everything to input in the template service var templates = new (string, string)[] { (entity.DownloadName, MimeTypes.Text), (entity.Body, entity.MarkupLanguage) };