public ActionResult PdfModel(string id) { // Since type is an ActionResult, we can still return an html view if something isn't right if (id != "yoda") return View("NotFound"); // get Person var person = new Person {UserName = id, LuckyNumber = 7}; // pass in Model, then View name var pdf = new PdfActionResult("HtmlToPdf", person); // Add to the view bag // pdf.ViewBag.Title = "Title from ViewBag"; return pdf; }
public ActionResult PdfModel(string id) { // Since type is an ActionResult, we can still return an html view if something isn't right if (id != "yoda") { return(View("NotFound")); } // get Person var person = new Person { UserName = id, LuckyNumber = 7 }; // pass in Model, then View name var pdf = new PdfActionResult("HtmlToPdf", person); // Add to the view bag // pdf.ViewBag.Title = "Title from ViewBag"; return(pdf); }
public ActionResult PrintInvoice(Guid id) { var result = new PdfActionResult <InvoiceController>(c => c.Invoice(id)); return(result); }