//return all purchase Order list public List <PurchaseOrder> GetAllPurchaseOrder(XeroCoreApi private_app_api) { List <PurchaseOrder> polist = private_app_api.PurchaseOrders.Find().ToList(); foreach (var purchase in polist) { Xero.Api.Core.File.BinaryFile pdfFile = private_app_api.PdfFiles.Get(Xero.Api.Core.Model.Types.PdfEndpointType.PurchaseOrders, purchase.Id); string _path = System.IO.Path.Combine(Server.MapPath("~/Pdf/Purchase"), purchase.Id + ".pdf"); pdfFile.Save(_path); } return(polist); }
//return all invoice list public List <Invoice> GetAllInvoiceBill(XeroCoreApi private_app_api) { List <Invoice> invoicelist = private_app_api.Invoices.Find().ToList(); foreach (var invoice in invoicelist) { //Guid invoiceId = invoice.Id; //Invoice invoice = private_app_api.Invoices.Find(invoiceId); Xero.Api.Core.File.BinaryFile pdfFile = private_app_api.PdfFiles.Get(Xero.Api.Core.Model.Types.PdfEndpointType.Invoices, invoice.Id); string _path = System.IO.Path.Combine(Server.MapPath("~/Pdf/Invoice"), invoice.Id + ".pdf"); pdfFile.Save(_path); } return(invoicelist); }