コード例 #1
0
        public IActionResult CreateNew()
        {
            string guid = _processor.CreateDocument("Sophiexam", "Hackathon 2020");

            if (guid == null)
            {
                return(NotFound("reference certificate not available"));
            }
            return(Content(GetLink("new", guid), "text/html"));
        }
コード例 #2
0
        private async Task <FormRequestResponse> ProcessMedicalFormRequest(MedicalFormRequest request)
        {
            switch (processingStrategy.MedicalForm)
            {
            case FormProcessingStrategyType.Email:
                await emailProcessor.ProcessMedicalFormRequest(request);

                return(new FormRequestResponse()
                {
                    ResponseType = FormRequestResponseType.EmailSent
                });

            case FormProcessingStrategyType.FillAndReturn:
                var documentId = documentProcessor.CreateDocument(request.User, request.PurposeOfTheRequest);
                return(new FormRequestDocumentGeneratedResponse()
                {
                    DocumentId = documentId
                });

            case FormProcessingStrategyType.PrefillAndEmail:
                throw new InvalidOperationException($"Cannot process a medical form request using {processingStrategy.MedicalForm} strategy");

            default:
                throw new ArgumentException($"Unkown type of strategy for Medical Form Request {processingStrategy.MedicalForm}");
            }
        }
コード例 #3
0
        public async Task <IActionResult> CreateDocument([FromRoute] string templateName,
                                                         [FromRoute] string mappingName,
                                                         [FromBody] DocumentPayload payload)
        {
            var document = await processor.CreateDocument(templateName, mappingName, payload);

            var fileContents = document.Buffer.ToMemoryStream();
            var contentType  = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";

            Response.Headers.Add("Access-Control-Expose-Headers", "Content-Disposition");
            return(new FileContentResult(fileContents.ToArray(), contentType)
            {
                FileDownloadName = document.FileName
            });
        }