public ViewResult SavePersonOffice(TemplateModelOffice templateModel) { if (ModelState.IsValid) { //Put your code here to use data to generate the tamplate // create a pdf from the generated template //add the url for the PDF here so they can download it SignUtilities util = new SignUtilities(host); try { string fileName = util.CreateSignOffice(templateModel.EmployeesOffice); TempData["GeneratedFile"] = fileName; } catch (Exception ex) { Console.WriteLine(ex); } return(View("Results")); } else { ModelState.AddModelError("", "Please correct the highlighted error below."); return(View("Office", templateModel)); } }
public ViewResult Office(int?numEmployees) { TemplateModelOffice templateModel = new TemplateModelOffice(); while (numEmployees > 0) { PersonOffice p = new PersonOffice(); templateModel.AddEmployeeOffice(p); numEmployees -= 1; } return(View("Office", templateModel)); }