Esempio n. 1
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}");
            }
        }
Esempio n. 2
0
 public async Task ProcessMedicalFormRequest(MedicalFormRequest message)
 {
     await emailService.SendEmail($"Adeverinta medicala {message.User}", $"Scopul adeverintei: {message.PurposeOfTheRequest}", emailFormMapping.MedicalForm);
 }
Esempio n. 3
0
 public async Task <FormRequestResponse> RequestMedicalForm([FromBody] MedicalFormRequest medicalFormRequest)
 {
     return(await ProcessForm(medicalFormRequest));
 }