public List<InvoiceDTOTable> getInvoices() { using (var context = new hctDBEntities()) { List<Invoice> inv = context.Invoices.OrderBy(i => i.Id).ToList(); List<InvoiceDTOTable> il = new List<InvoiceDTOTable>(); foreach (Invoice i in inv) { InvoiceDTOTable cdt = new InvoiceDTOTable(); cdt.InvoiceID = i.InvoiceID; cdt.DateCreated = i.dateCreated.ToString(); cdt.Name = i.name; cdt.PaymentStatus = i.paymentStatus; cdt.JobStatus = i.jobStatus; il.Add(cdt); } return il; } }
public List <InvoiceDTOTable> getInvoices() { using (var context = new hctDBEntities()) { List <Invoice> inv = context.Invoices.OrderBy(i => i.Id).ToList(); List <InvoiceDTOTable> il = new List <InvoiceDTOTable>(); foreach (Invoice i in inv) { InvoiceDTOTable cdt = new InvoiceDTOTable(); cdt.InvoiceID = i.InvoiceID; cdt.DateCreated = i.dateCreated.ToString(); cdt.Name = i.name; cdt.PaymentStatus = i.paymentStatus; cdt.JobStatus = i.jobStatus; il.Add(cdt); } return(il); } }