Esempio n. 1
0
        public async Task <OperationResult> UpdateReportHeaders(EformDocxReportHeadersModel eformDocxReportHeadersModel)
        {
            var core = await _coreHelper.GetCore();

            var sdkDbContext = core.DbContextHelper.GetDbContext();
            var template     = await sdkDbContext.CheckLists.Where(x => x.Id == eformDocxReportHeadersModel.TemplateId)
                               .FirstOrDefaultAsync();

            if (template == null)
            {
                return(new OperationResult(false, _localizationService.GetString("TemplateNotFound")));
            }

            if (!string.IsNullOrEmpty(eformDocxReportHeadersModel.H1))
            {
                template.ReportH1 = eformDocxReportHeadersModel.H1.Trim(); // delete whitespaces in start & end string
            }

            if (!string.IsNullOrEmpty(eformDocxReportHeadersModel.H2))
            {
                template.ReportH2 = eformDocxReportHeadersModel.H2.Trim();
            }

            if (!string.IsNullOrEmpty(eformDocxReportHeadersModel.H3))
            {
                template.ReportH3 = eformDocxReportHeadersModel.H3.Trim();
            }

            if (!string.IsNullOrEmpty(eformDocxReportHeadersModel.H4))
            {
                template.ReportH4 = eformDocxReportHeadersModel.H4.Trim();
            }

            if (!string.IsNullOrEmpty(eformDocxReportHeadersModel.H5))
            {
                template.ReportH5 = eformDocxReportHeadersModel.H5.Trim();
            }

            await template.Update(sdkDbContext);

            return(new OperationResult(true));
        }
Esempio n. 2
0
 public async Task <OperationResult> UpdateHeadersReport(
     [FromBody] EformDocxReportHeadersModel eformDocxReportHeadersModel)
 {
     return(await _eformCaseReportService.UpdateReportHeaders(eformDocxReportHeadersModel));
 }