I have Shared the Code
public async Task<IActionResult> GetCareSummary(CareSummaryReq request)
{
try
{
string mintype = "";
int extension = 1;
string ReportPath = "", ReportPathSave = "";
string webRootPath = _hostingEnvironment.WebRootPath;
System.Data.DataTable dt1 = new System.Data.DataTable();
System.Data.DataTable dt2 = new System.Data.DataTable();
Report_Service fmr = new Report_Service();
ReportPath = "Reports\\CareSummary.rdlc";
ReportPathSave = "ReportPdf\\CareSummary.pdf";
string path = Path.Combine(webRootPath, ReportPath);
string pathSave = Path.Combine(webRootPath, ReportPathSave);
LocalReport localReport = new LocalReport(path);
dt1 = await fmr.GetData("EXEC pr_RDL_CareSummary '" + request.FrmDt + "','" + request.ToDt + "'," + Convert.ToString(request.Skillid) + "," + Convert.ToString(request.BranchId) + ",'" + request.Mode + "'," + Convert.ToString(request.RptUserId) + "");
localReport.AddDataSource("SaylussNewDataset", dt1);
dt2 = await fmr.GetData("EXEC Pr_GetReportHeader " + Convert.ToString(request.RptUserId) + "," + Convert.ToString(request.BranchId) + "");
localReport.AddDataSource("ReportDataset", dt2);
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("FrmDt", request.FrmDt.ToString());
parameters.Add("ToDt", request.ToDt.ToString());
parameters.Add("Skillid", request.Skillid.ToString());
parameters.Add("BranchId", request.BranchId.ToString());
parameters.Add("Mode", request.Mode.ToString());
parameters.Add("RptUserId", request.RptUserId.ToString());
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
var result = localReport.Execute(RenderType.Pdf, extension, parameters, mintype);
byte[] file = result.MainStream;
System.IO.Stream stream = new System.IO.MemoryStream(file);
return File(stream, "application/pdf", "CareSummary.pdf");
}
catch (Exception ex)
{
return Ok(ex.ToString());
}
}