public ActionResult GeneratePdf() { var supplier = UserManager.GetActiveCustomer(HttpContext); var currentPage = new DryingAgreementPage(); if (SiteUser == null || supplier == null) { return(HttpNotFound()); } var dryingAgreement = _purchaseRepository.GetDryingAgreement(); var model = new DryingAgreementViewModel(currentPage) { Agreement = dryingAgreement ?? new DryingAgreement(), Customer = _purchaseRepository.GetCustomer(supplier.CustomerNo) ?? new Customer(), }; return(View("~/Views/AppPages/DryingAgreementPage/DryingAgreementPdf.cshtml", model)); }