我正在使用 MVC 4 创建应用程序。我正在使用 Rotativa 创建一个 pdf。我用一个复杂的模型调用 ActionAsPdf
我的模型是
public class BrandingDetails
{
public int PDFFileNo { get; set; }
public string LogoImageUrl { get; set; }
public string WebsiteUrl { get; set; }
public string PhoneNumber_AU { get; set; }
public string PhoneNumber_NZ { get; set; }
public string FacebookImageUrl { get; set; }
public string TwitterImageUrl { get; set; }
public string PinterestImageUrl { get; set; }
public string YoutubeImageUrl { get; set; }
public string CruiseCode { get; set; }
public string ShipName { get; set; }
public string PortName { get; set; }
public string SailDate { get; set; }
public string CruiseNights { get; set; }
public string Destinations { get; set; }
public string QuoteRef { get; set; }
public string CruiseName { get; set; }
public string DescriptionCruise { get; set; }
public IEnumerable<CruiseOptions> CruiseOptions { get; set; }
}
我打电话给以下
var viewModel = QuoteHelper.GetViewModel(item);
var pdfResult = new ActionAsPdf("CruiseDetails", quoteDetails, cruiseOptions);
var binary = pdfResult.BuildPdf(this.ControllerContext);
我调用的 Action 方法是
public ActionResult CruiseDetails(BrandingDetails quoteDetails, IEnumerable<CruiseOptions> cruiseOptions)
{
return View("CruiseDetails", quoteDetails);
}
但是由于某种原因,当我将它传递给 Action 时,所有数据都通过了 CruiseOptions .. 被设置为无元素......这怎么可能?