public ActionResult AnnualReport() { var report = Service.GetAnnualReport(); var pdfResult = new PdfResult(report, "PdfAnnualReport"); pdfResult.ViewBag.Title = "Annual Report"; return(pdfResult); }
public ActionResult MonthlyReport() { var report = Service.GetMonthlyReport(); var pdfResult = new PdfResult(report, "PdfMonthlyReport"); pdfResult.ViewBag.Title = "Monthly Report"; return(pdfResult); }
public ActionResult PrintContract(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var loanApplication = Service.Find <LoanApplication>(id); if (loanApplication.Status != LoanApplicationStatus.Contracted) { loanApplication.Status = LoanApplicationStatus.ContractPrinted; } var pdfResult = new PdfResult(loanApplication, "PdfContract"); pdfResult.ViewBag.Title = "PROebank loan contract"; return(pdfResult); }
protected ActionResult Pdf(string fileDownloadName, string viewName, object model) { // Based on View() code in Controller base class from MVC if (model != null) { ViewData.Model = model; } PdfResult pdf = new PdfResult() { FileDownloadName = fileDownloadName, ViewName = viewName, ViewData = ViewData, TempData = TempData, ViewEngineCollection = ViewEngineCollection }; return(pdf); }
public ActionResult Preview(LoanApplication loanApplication) { if (loanApplication == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var laId = loanApplication.Id; String password = null; // check customer here because of using default UserStore and UserManager var loanApplicationSet = UnitOfWork.GetDbSet <LoanApplication>(); loanApplication = loanApplicationSet.Find(laId); var doc = loanApplication.PersonalData; var customerManager = new UserManager <IdentityUser>(new UserStore <IdentityUser>(Context)); var customers = Context.Set <Customer>(); var customer = customers .SingleOrDefault(c => c.PersonalData.Identification == doc.Identification); if (customer == null) { customer = new Customer { PersonalData = doc, Email = loanApplication.Email, Id = Guid.NewGuid().ToString(), Phone = loanApplication.CellPhone, UserName = CustomerHelper.GenerateName(customerManager, doc), }; password = System.Web.Security.Membership.GeneratePassword(10, 1); customerManager.Create(customer, password); customerManager.AddToRole(customer.Id, "Customer"); } else { // TODO: check doc.Id customer.PersonalData = doc; } loanApplication = Service.Find <LoanApplication>(laId); switch (loanApplication.Status) { case LoanApplicationStatus.Approved: case LoanApplicationStatus.ContractPrinted: var loan = Service.CreateLoanContract(customer, loanApplication, User.Identity.GetUserId()); if (loan == null) { return(HttpNotFound("Failed to create loan")); } Service.SignLoanContract(loanApplication.Id); var pdfViewModel = new LoanPdfViewModel { UserName = customer.UserName, Password = password, Loan = loan }; var pdfResult = new PdfResult(pdfViewModel, "Pdf"); pdfResult.ViewBag.Title = "PROebank credentials"; return(pdfResult); //case LoanApplicationStatus.ContractPrinted: // return RedirectToAction("Index"); // TODO: maybe another page default: return(RedirectToAction("Index")); } }