my application is MVC3 (ASPX views). I have a form, in the Edit view I have save button, that saves the form and return to the index page, and another button to print PDF from another ActionResult in the same controller as Edit; it there a way to save and print the PDF from one button? Here is my script for edit view:
public ActionResult EditCTAH(long learnerID = 0, long caseListID = 0)
{
ViewBag.caseListID = (long)Session["_CTA_CaseListId"];
try
{
CTAHFormEdit ctform = _learnerscaseListsSvc.GetCTAHForm(learnerID, caseListID);
return View(ctform);
}
catch
{
return null;
}
}
[HttpPost]
public ActionResult EditCATH(CTAHFormEdit ctform)
{
if (ModelState.IsValid)
{
_learnerscaseListsSvc.EditCTAHForm(ctform);
long courseId = (long)Session["_CTA_CourseId"];
long caseId = (long)Session["_CTA_CaseId"];
long caselistId = (long)Session["_CTA_CaseListId"];
return RedirectToAction("Index", new { courseId = courseId, caseId = caseId, caselistId = caselistId });
}
return View(ctform);
}
and here is the script for printing the PDF:
public ActionResult EvaluationCATH_PDF(long learnerID = 0, long caseListID = 0)
{
try
{
.....
pdfStamper.Close();
byte[] byteInfo = workStream.ToArray();
SendPdfToBrowser(byteInfo, cth.Learner_ID, cth.StudyCase_ID);
return null;
}
catch
{
return null;
}
}
Thanks in advance.