public async Task <IActionResult> CreateReport(CreateReportViewModel createReportViewModel) { if (!ModelState.IsValid) { return(View(createReportViewModel)); } try { ReportCreationResources reportCreationResources = new ReportCreationResources { HospitalId = createReportViewModel.HospitalId, Description = createReportViewModel.Description, DiseaseName = createReportViewModel.DiseaseName, IsChronicDisease = createReportViewModel.IsChronicDisease, PatientId = createReportViewModel.PatientId }; await _reportService.CreateReport(reportCreationResources); _session.SetString("ReportSaved", "true"); return(RedirectToAction("CreateReport")); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ReportTuble> CreateReport(ReportCreationResources reportCreationResources) { var responseMessage = await _httpClientService.SendHttpPostRequest(reportCreationResources, "report/createreport"); var report = JsonConvert.DeserializeObject <ReportTuble>(responseMessage); return(report); }