public IActionResult Index(IndexPatientReceptionViewModel model) { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); List <DataSetsValues> list = _patientReceptionsRepository.GetAllPatientReceptions(model.StartDateTime, model.EndDateTime) .Select(x => new DataSetsValues { PatientFirstName = x.PatientFirstName, DateOfReception = x.DateOfReception, DoctorFirstName = x.DoctorFirstName, DoctorLastName = x.DoctorLastName, DoctorLicenseNumber = x.DoctorLicenseNumber, EmergencyCase = x.EmergencyCase, IsThereMedicalReport = x.IsThereMedicalReport, PatientLastName = x.PatientLastName, PatientReceptionId = x.PatientReceptionId, MedicalReport = string.IsNullOrEmpty(x.MedicalReport) ? "Medical report doesn't exist!" : x.MedicalReport }).ToList(); LocalReport _localReport = new LocalReport("Reports/Report1.rdlc"); _localReport.AddDataSource("DataSet1", list); ReportResult result = _localReport.Execute(RenderType.Pdf); return(File(result.MainStream, "application/pdf")); }
public IActionResult Index() { IndexPatientReceptionViewModel model = new IndexPatientReceptionViewModel(); model.StartDateTime = DateTime.Now.AddMonths(-1); model.EndDateTime = DateTime.Now; model.PatientReceptionList = _PatientReceptionsRepository.GetAllPatientReceptions(model.StartDateTime, model.EndDateTime).ToList(); return(View(model)); }
public IActionResult Index(IndexPatientReceptionViewModel model) { if (!model.StartDateTime.HasValue || !model.EndDateTime.HasValue) { ModelState.AddModelError("", "Start date time and end date time must have a value"); } if (model.StartDateTime.GetValueOrDefault() > model.EndDateTime.GetValueOrDefault()) { ModelState.AddModelError("", "Please check input of dates"); } if (!ModelState.IsValid) { model.PatientReceptionList = new List <Models.Dtos.PatientReceptionDto>(); return(View(model)); } model.PatientReceptionList = _PatientReceptionsRepository.GetAllPatientReceptions(model.StartDateTime, model.EndDateTime).ToList(); return(View(model)); }