I am creating an MVC 4 application. I am using Rotativa to generate pdfs
they have a method called
public ActionAsPdf(string action, object routeValues);
I am having trouble passing in a complex object to the routeValues
i.e:
I have a viewModel
public class FullName
{
public string FirstName { get; set; }
public string Surname { get; set; }
}
public ActionResult Index(FullName name)
{
ViewBag.Message = string.Format("Hello {0} to ASP.NET MVC!", name);
return View();
}
public ActionResult Test()
{
var fullname = new FullName();
fullname.FirstName = "John";
fullname.Surname = "Smith";
return new ActionAsPdf("Index", new { name = fullname }) { FileName = "Test.pdf" };
}
when I step through, in the Index
action the name is null... how do I pass the complex model through?
Check this