public ActionResult GenerateInvoice(CustomerServiceModel model) { var invoice = new InvoiceModel(); var customer = CustomerManager.GetById(model.SelectedCustomer); var seller = SellerManager.GetById(1); var services = ServiceManager.GetServiceByIds(model.SelectedServices); invoice.Name = customer.Name; invoice.Surname = customer.Surname; invoice.City = customer.City; invoice.CompanyName = customer.CompanyName; invoice.Code = customer.Code; invoice.NIP = customer.NIP; invoice.CompanyName = customer.CompanyName; invoice.Street = customer.Street; invoice.PhoneNumber = customer.PhoneNumber; invoice.SellerName = seller.Name; invoice.SellerSurname = seller.Surname; invoice.SellerCity = seller.City; invoice.SellerCompanyName = customer.CompanyName; invoice.SellerCode = seller.Code; invoice.SellerNIP = seller.NIP; invoice.SellerStreet = seller.Street; invoice.SellerPhoneNumber = seller.PhoneNumber; invoice.SellerCompanyName = seller.CompanyName; invoice.AllServices = services.ToList(); invoice.CustomerId = customer.Id; return View("Invoice", invoice); }
public ActionResult Pdf(InvoiceModel model, string Save) { var invoice = new InvoiceModel(); var customer = CustomerManager.GetById(model.CustomerId); var seller = SellerManager.GetById(1); var services = ServiceManager.GetServiceByIds(model.lista); invoice.Name = customer.Name; invoice.Surname = customer.Surname; invoice.City = customer.City; invoice.CompanyName = customer.CompanyName; invoice.Code = customer.Code; invoice.NIP = customer.NIP; invoice.CompanyName = customer.CompanyName; invoice.Street = customer.Street; invoice.PhoneNumber = customer.PhoneNumber; invoice.SellerName = seller.Name; invoice.SellerSurname = seller.Surname; invoice.SellerCity = seller.City; invoice.SellerCompanyName = customer.CompanyName; invoice.SellerCode = seller.Code; invoice.SellerNIP = seller.NIP; invoice.SellerStreet = seller.Street; invoice.SellerPhoneNumber = seller.PhoneNumber; invoice.SellerCompanyName = seller.CompanyName; invoice.CustomerId = customer.Id; invoice.AllServices = services.ToList(); if (Save != null) { return new Rotativa.ViewAsPdf("Pdf", invoice) { FileName = "TestViewAsPdf.pdf" }; } return new Rotativa.ViewAsPdf("Pdf", invoice); }