// Calls the view to load the pdf. public ActionResult PrintPaymentSlip(int id) { var payment = new Rotativa.PartialViewAsPdf("IndexById", db.GetDbSet <Payment>().Include("Member").Where(p => p.Id == id).First()); ViewBag.DateTime = DateTime.Now; return(payment); }
public ActionResult ViewAsPdf(string GridHtml) { if (IsUserLoggedIn()) { if (IsAdmin()) { var facilities = _facilityService.GetAll(); var model = new StandardIndexViewModel(facilities); var pdfResult = new Rotativa.PartialViewAsPdf("ViewReport", model); return(pdfResult); } else { ModelState.AddModelError("", USER_ACCESS_ERR_MSG); return(View()); } } else { ModelState.AddModelError("", USER_LOGIN_ERR_MSG); } return(RedirectToAction("Login", "Standard", new { area = "" })); }