public async Task <InvoiceToReturnVM> GetInvoiceById(int id) { InvoiceToReturnVM invoiceToReturnVM = new InvoiceToReturnVM(); InvoiceDomainModel invoiceDomainModel = await invoiceBusiness.GetInvoiceById(id); AutoMapper.Mapper.Map(invoiceDomainModel, invoiceToReturnVM); return(invoiceToReturnVM); }
public async Task <InvoiceDomainModel> GetInvoiceById(int id) { InvoiceDomainModel invoice = new InvoiceDomainModel(); var model = await invoiceRepository.SingleOrDefault(i => i.invoice_id == id); if (model != null) { invoice.invoice_id = model.invoice_id; invoice.date = model.date; invoice.totalQty = model.totalQty; invoice.totalAmount = model.totalAmount; invoice.AmountTendered = model.AmountTendered; invoice.change = model.change; invoice.user_id = model.user_id; } return(invoice); }